PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.3
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.3
6.3 6.2.3 6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 All 157 releases
← All changes | modules/logs/connectors/class-connector-user.php +105 -109 5.0.1 → 6.3 View file →
@@ -13,131 +13,127 @@
13 13 /**
14 14 * Class Connector_User
15 15 */
16 16 class Connector_User extends Log_Connector {
17 - /**
18 - * Connector slug
19 - *
20 - * @var string
21 - */
22 - public $name = 'users';
17 + /**
18 + * Connector slug
19 + *
20 + * @var string
21 + */
22 + public $name = 'users';
23 23
24 24
25 - /**
26 - * Actions registered for this connector
27 - *
28 - * @var array
29 - */
30 - public $actions = array(
31 - 'mainwp_user_action',
32 - );
25 + /**
26 + * Actions registered for this connector
27 + *
28 + * @var array
29 + */
30 + public $actions = array(
31 + 'mainwp_user_action',
32 + );
33 33
34 - /**
35 - * Return translated connector label
36 - *
37 - * @return string Translated connector label
38 - */
39 - public function get_label() {
40 - return esc_html__( 'Users', 'mainwp' );
41 - }
34 + /**
35 + * Return translated connector label
36 + *
37 + * @return string Translated connector label
38 + */
39 + public function get_label() {
40 + return esc_html__( 'Users', 'mainwp' );
41 + }
42 42
43 - /**
44 - * Return translated action term labels
45 - *
46 - * @return array Action terms label translation
47 - */
48 - public function get_action_labels() {
49 - return array(
50 - 'created' => esc_html__( 'Created', 'mainwp' ),
51 - 'update' => esc_html__( 'Updated', 'mainwp' ),
52 - 'delete' => esc_html__( 'Deleted', 'mainwp' ),
53 - 'update_password' => esc_html__( 'Updated password', 'mainwp' ),
54 - 'change_role' => esc_html__( 'Change role', 'mainwp' ),
55 - );
56 - }
43 + /**
44 + * Return translated action term labels
45 + *
46 + * @return array Action terms label translation
47 + */
48 + public function get_action_labels() {
49 + return array(
50 + 'created' => esc_html__( 'Created', 'mainwp' ),
51 + 'update' => esc_html__( 'Updated', 'mainwp' ),
52 + 'delete' => esc_html__( 'Deleted', 'mainwp' ),
53 + 'update_password' => esc_html__( 'Updated password', 'mainwp' ),
54 + 'change_role' => esc_html__( 'Change role', 'mainwp' ),
55 + );
56 + }
57 57
58 - /**
59 - * Return translated context labels
60 - *
61 - * @return array Context label translations
62 - */
63 - public function get_context_labels() {
64 - return array(
65 - 'users' => esc_html__( 'Users', 'mainwp' ),
66 - );
67 - }
58 + /**
59 + * Return translated context labels
60 + *
61 + * @return array Context label translations
62 + */
63 + public function get_context_labels() {
64 + return array(
65 + 'users' => esc_html__( 'Users', 'mainwp' ),
66 + );
67 + }
68 68
69 - /**
70 - * Log user actions.
71 - *
72 - * @action mainwp_user_action
73 - *
74 - * @param object $website website data.
75 - * @param string $pAction post action.
76 - * @param array $data data array.
77 - * @param mixed $extra extra info.
78 - * @param bool $optimize true|false optimize big site or not.
79 - */
80 - public function callback_mainwp_user_action( $website, $pAction, $data, $extra = array(), $optimize = false ) {
69 + /**
70 + * Log user actions.
71 + *
72 + * @action mainwp_user_action
73 + *
74 + * @param object $website website data.
75 + * @param string $pAction post action.
76 + * @param array $data data array.
77 + */
78 + public function callback_mainwp_user_action( $website, $pAction, $data ) {
81 79
82 - if ( empty( $website ) || ! is_object( $website ) || empty( $website->id ) || ! is_array( $data ) ) {
83 - return;
84 - }
80 + if ( empty( $website ) || ! is_object( $website ) || empty( $website->id ) || ! is_array( $data ) ) {
81 + return;
82 + }
85 83
86 - $action = '';
84 + $action = '';
87 85
88 - $userId = 0;
86 + $userId = 0;
89 87
90 - if ( isset( $data['user_id'] ) ) {
91 - $userId = intval( $data['user_id'] );
92 - }
88 + if ( isset( $data['user_id'] ) ) {
89 + $userId = intval( $data['user_id'] );
90 + }
93 91
94 - if ( empty( $userId ) ) {
95 - return;
96 - }
92 + if ( empty( $userId ) ) {
93 + return;
94 + }
97 95
98 - $display_name = isset( $data['display_name'] ) ? $data['display_name'] : '';
96 + $display_name = isset( $data['display_name'] ) ? $data['display_name'] : '';
99 97
100 - $args = array(
101 - 'display_name' => $display_name,
102 - 'roles' => isset( $data['roles'] ) ? $data['roles'] : '',
103 - 'user_id' => $userId,
104 - );
98 + $args = array(
99 + 'display_name' => $display_name,
100 + 'roles' => isset( $data['roles'] ) ? $data['roles'] : '',
101 + 'user_id' => $userId,
102 + );
105 103
106 - // translators: 1: User display name, 2: Roles.
107 - $message = esc_html_x(
108 - '%1$s',
109 - '1: User display name',
110 - 'mainwp'
111 - );
104 + // translators: %1$s: User display name.
105 + $message = esc_html_x(
106 + 'User: %1$s',
107 + '1: User display name',
108 + 'mainwp'
109 + );
112 110
113 - if ( 'created' === $pAction ) {
114 - $action = 'created';
115 - } elseif ( 'delete' === $pAction ) {
116 - $action = 'delete';
117 - } elseif ( 'changeRole' === $pAction ) {
118 - $action = 'change_role';
119 - $args['old_roles'] = isset( $data['old_roles'] ) ? $data['old_roles'] : '';
120 - } elseif ( 'newadminpassword' === $pAction ) {
121 - $action = 'update_password';
122 - } elseif ( 'update_password' === $pAction ) {
123 - $action = 'update_password';
124 - } elseif ( 'update_user' === $pAction ) {
125 - $action = 'update';
126 - } else {
127 - return;
128 - }
111 + if ( 'created' === $pAction ) {
112 + $action = 'created';
113 + } elseif ( 'delete' === $pAction ) {
114 + $action = 'delete';
115 + } elseif ( 'changeRole' === $pAction ) {
116 + $action = 'change_role';
117 + $args['old_roles'] = isset( $data['old_roles'] ) ? $data['old_roles'] : '';
118 + } elseif ( 'newadminpassword' === $pAction ) {
119 + $action = 'update_password';
120 + } elseif ( 'update_password' === $pAction ) {
121 + $action = 'update_password';
122 + } elseif ( 'update_user' === $pAction ) {
123 + $action = 'update';
124 + } else {
125 + return;
126 + }
129 127
130 - $args['siteurl'] = $website->url;
131 - $args['site_name'] = $website->name;
132 - $state = 1;
128 + $state = 1;
133 129
134 - $this->log(
135 - $message,
136 - $args,
137 - $website->id,
138 - 'users',
139 - $action,
140 - $state
141 - );
142 - }
130 + $this->log(
131 + $message,
132 + $args,
133 + $website->id,
134 + 'users',
135 + $action,
136 + $state
137 + );
138 + }
143 139 }