PluginProbe
wpForo Forum / 3.1.5
wpForo Forum v3.1.5
3.1.5 3.1.4 3.1.2 3.1.1 3.1.0 3.0.9 3.0.8 3.0.7 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 All 137 releases
wpforo / modules / mentioning / classes / Template.php

Template.php in wpForo Forum 3.1.5, at modules/mentioning/classes/Template.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace wpforo\modules\mentioning\classes;
4
5 class Template {
6 public function __construct() {
7 $this->init_hooks();
8 }
9
10 private function init_hooks() {
11 add_filter( 'wpforo_member_get_actions', [ $this, 'add_member_action' ], 9, 2 );
12 }
13
14 public function get_currentstate_ico( $currentstate ) {
15 return ( $currentstate ? '<i class="fas fa-bell-slash"></i>' : '<i class="fas fa-bell"></i>' );
16 }
17
18 public function add_member_action( $actions, $user ) {
19 $userid = $user['userid'];
20 return array_merge( [ 'mute_mention' => [
21 'label' => ( $user['is_mention_muted'] ? wpforo_phrase( 'Unmute Mentioning Emails', false ) : wpforo_phrase( 'Mute Mentioning Emails', false ) ),
22 'ico' => $this->get_currentstate_ico( $user['is_mention_muted'] ),
23 'callback_for_can' => function() use ($userid){
24 return $userid === WPF()->current_userid;
25 },
26 'callback_for_get_url' => function() use ( $userid ){
27 return '';
28 },
29 'data' => [
30 'currentstate' => (int) $user['is_mention_muted'],
31 'active_label' => wpforo_phrase( 'Unmute Mentioning Emails', false ),
32 'inactive_label' => wpforo_phrase( 'Mute Mentioning Emails', false ),
33 ],
34 ] ], $actions );
35 }
36 }
37