User Role Editor - Version 4.53

Version Description

Download this release

Release Info

Developer shinephp
Plugin Icon 128x128 User Role Editor
Version 4.53
Comparing to
See all releases

Code changes from version 4.52.2 to 4.53

includes/classes/ajax-processor.php CHANGED
@@ -79,6 +79,92 @@ class URE_Ajax_Processor {
79
  // end of check_user_cap()
80
 
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  protected function get_caps_to_remove() {
83
 
84
  $html = URE_Role_View::caps_to_remove_html();
@@ -174,6 +260,18 @@ class URE_Ajax_Processor {
174
  protected function _dispatch() {
175
 
176
  switch ($this->action) {
 
 
 
 
 
 
 
 
 
 
 
 
177
  case 'get_caps_to_remove':
178
  $answer = $this->get_caps_to_remove();
179
  break;
@@ -188,6 +286,9 @@ class URE_Ajax_Processor {
188
  break;
189
  case 'get_role_caps':
190
  $answer = $this->get_role_caps();
 
 
 
191
  break;
192
  default:
193
  $answer = array('result' => 'error', 'message' => 'Unknown action "' . $this->action . '"');
79
  // end of check_user_cap()
80
 
81
 
82
+ protected function add_role() {
83
+
84
+ $editor = URE_Editor::get_instance();
85
+ $response = $editor->add_new_role();
86
+
87
+ $answer = array(
88
+ 'result'=>$response['result'],
89
+ 'role_id'=>$response['role_id'],
90
+ 'role_name'=>$response['role_name'],
91
+ 'message'=>$response['message']
92
+ );
93
+
94
+ return $answer;
95
+ }
96
+ // end of add_role()
97
+
98
+
99
+ protected function add_capability() {
100
+
101
+ $notification = URE_Capability::add( 'role' );
102
+ $editor = URE_Editor::get_instance();
103
+ $editor->init1();
104
+ $message = $editor->init_current_role_name();
105
+ if (empty( $message ) ) {
106
+ $view = new URE_View();
107
+ $html = $view->_show_capabilities( true, true );
108
+ } else {
109
+ $html = '';
110
+ }
111
+
112
+ $answer = array('result'=>'success', 'html'=>$html, 'message'=>$notification);
113
+
114
+ return $answer;
115
+ }
116
+ // end of add_capability()
117
+
118
+
119
+ protected function delete_capability() {
120
+
121
+ $result = URE_Capability::delete();
122
+ if ( is_array( $result ) ) {
123
+ $notification = $result['message'];
124
+ $deleted_caps = $result['deleted_caps'];
125
+ } else {
126
+ $notification = $result;
127
+ $deleted_caps = array();
128
+ }
129
+
130
+ $answer = array('result'=>'success', 'deleted_caps'=>$deleted_caps, 'message'=>$notification);
131
+
132
+ return $answer;
133
+ }
134
+ // end of delete_cap()
135
+
136
+
137
+ protected function delete_role() {
138
+
139
+ $editor = URE_Editor::get_instance();
140
+ $response = $editor->delete_role();
141
+ $answer = array(
142
+ 'result'=>$response['result'],
143
+ 'message'=>$response['message'],
144
+ 'deleted_roles'=> $response['deleted_roles']
145
+ );
146
+
147
+ return $answer;
148
+ }
149
+ // end of delete_role()
150
+
151
+
152
+ protected function rename_role() {
153
+
154
+ $editor = URE_Editor::get_instance();
155
+ $response = $editor->rename_role();
156
+ $answer = array(
157
+ 'result'=>$response['result'],
158
+ 'message'=>$response['message'],
159
+ 'role_id'=> $response['role_id'],
160
+ 'role_name'=>$response['role_name']
161
+ );
162
+
163
+ return $answer;
164
+ }
165
+ // end of rename_role()
166
+
167
+
168
  protected function get_caps_to_remove() {
169
 
170
  $html = URE_Role_View::caps_to_remove_html();
260
  protected function _dispatch() {
261
 
262
  switch ($this->action) {
263
+ case 'add_role':
264
+ $answer = $this->add_role();
265
+ break;
266
+ case 'add_capability':
267
+ $answer = $this->add_capability();
268
+ break;
269
+ case 'delete_capability':
270
+ $answer = $this->delete_capability();
271
+ break;
272
+ case 'delete_role':
273
+ $answer = $this->delete_role();
274
+ break;
275
  case 'get_caps_to_remove':
276
  $answer = $this->get_caps_to_remove();
277
  break;
286
  break;
287
  case 'get_role_caps':
288
  $answer = $this->get_role_caps();
289
+ break;
290
+ case 'rename_role':
291
+ $answer = $this->rename_role();
292
  break;
293
  default:
294
  $answer = array('result' => 'error', 'message' => 'Unknown action "' . $this->action . '"');
includes/classes/capability.php CHANGED
@@ -75,30 +75,30 @@ class URE_Capability {
75
  public static function add( $ure_object ) {
76
  global $wp_roles;
77
 
78
- if (!current_user_can('ure_create_capabilities')) {
79
- return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
80
  }
81
 
82
  $mess = '';
83
  if (!isset($_POST['capability_id']) || empty($_POST['capability_id'])) {
84
- return 'Wrong Request';
85
  }
86
 
87
- $data = self::validate($_POST['capability_id']);
88
- if (!$data['result']) {
89
  return $data['message'];
90
  }
91
 
92
  $cap_id = $data['cap_id'];
93
  $lib = URE_Lib::get_instance();
94
  $full_capabilities = $lib->init_full_capabilities( $ure_object );
95
- if (!isset($full_capabilities[$cap_id])) {
96
  $admin_role = $lib->get_admin_role();
97
  $wp_roles->use_db = true;
98
- $wp_roles->add_cap($admin_role, $cap_id);
99
- $mess = sprintf(esc_html__('Capability %s was added successfully', 'user-role-editor'), $cap_id);
100
  } else {
101
- $mess = sprintf(esc_html__('Capability %s exists already', 'user-role-editor'), $cap_id);
102
  }
103
 
104
  return $mess;
@@ -111,14 +111,20 @@ class URE_Capability {
111
  *
112
  * @return array
113
  */
114
- private static function get_caps_for_deletion_from_post($caps_allowed_to_remove) {
115
-
 
 
 
 
 
 
116
  $caps = array();
117
- foreach($_POST as $key=>$value) {
118
- if (substr($key, 0, 3)!=='rm_') {
119
  continue;
120
  }
121
- if (!isset($caps_allowed_to_remove[$value])) {
122
  continue;
123
  }
124
  $caps[] = $value;
@@ -179,39 +185,35 @@ class URE_Capability {
179
  * @return string - information message
180
  */
181
  public static function delete() {
182
-
183
- if (!isset($_POST['action']) || $_POST['action']!='delete-user-capability') {
184
- return 'Wrong Request';
185
- }
186
-
187
- if (!current_user_can('ure_delete_capabilities')) {
188
- return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
189
  }
190
 
191
  $capabilities = URE_Capabilities::get_instance();
192
  $mess = '';
193
  $caps_allowed_to_remove = $capabilities->get_caps_to_remove();
194
- if (!is_array($caps_allowed_to_remove) || count($caps_allowed_to_remove) == 0) {
195
- return esc_html__('There are no capabilities available for deletion!', 'user-role-editor');
196
  }
197
 
198
- $caps = self::get_caps_for_deletion_from_post($caps_allowed_to_remove);
199
- if (empty($caps)) {
200
- return esc_html__('There are no capabilities available for deletion!', 'user-role-editor');
201
  }
202
 
203
- self::revoke_caps($caps);
204
 
205
- if (count($caps)==1) {
206
- $mess = sprintf(esc_html__('Capability %s was removed successfully', 'user-role-editor'), $caps[0]);
207
  } else {
208
  $lib = URE_Lib::get_instance();
209
  $short_list_str = $lib->get_short_list_str( $caps );
210
- $mess = count($caps) .' '. esc_html__('capabilities were removed successfully', 'user-role-editor') .': '.
211
  $short_list_str;
212
  }
213
 
214
- return $mess;
215
  }
216
  // end of delete()
217
 
75
  public static function add( $ure_object ) {
76
  global $wp_roles;
77
 
78
+ if ( !current_user_can( 'ure_create_capabilities' ) ) {
79
+ return esc_html__( 'Insufficient permissions to work with User Role Editor', 'user-role-editor' );
80
  }
81
 
82
  $mess = '';
83
  if (!isset($_POST['capability_id']) || empty($_POST['capability_id'])) {
84
+ return esc_html__( 'Wrong Request', 'user-role-editor' );
85
  }
86
 
87
+ $data = self::validate( $_POST['capability_id'] );
88
+ if ( !$data['result'] ) {
89
  return $data['message'];
90
  }
91
 
92
  $cap_id = $data['cap_id'];
93
  $lib = URE_Lib::get_instance();
94
  $full_capabilities = $lib->init_full_capabilities( $ure_object );
95
+ if ( !isset( $full_capabilities[$cap_id] ) ) {
96
  $admin_role = $lib->get_admin_role();
97
  $wp_roles->use_db = true;
98
+ $wp_roles->add_cap( $admin_role, $cap_id );
99
+ $mess = sprintf( esc_html__( 'Capability %s was added successfully', 'user-role-editor' ), $cap_id );
100
  } else {
101
+ $mess = sprintf( esc_html__( 'Capability %s exists already', 'user-role-editor' ), $cap_id );
102
  }
103
 
104
  return $mess;
111
  *
112
  * @return array
113
  */
114
+ private static function get_caps_for_deletion_from_post( $caps_allowed_to_remove ) {
115
+
116
+ if ( isset( $_POST['values'] ) ) {
117
+ $input_buff = $_POST['values'];
118
+ } else {
119
+ $input_buff = $_POST;
120
+ }
121
+
122
  $caps = array();
123
+ foreach( $input_buff as $key=>$value ) {
124
+ if ( substr( $key, 0, 3 )!=='rm_' ) {
125
  continue;
126
  }
127
+ if ( !isset( $caps_allowed_to_remove[$value]) ) {
128
  continue;
129
  }
130
  $caps[] = $value;
185
  * @return string - information message
186
  */
187
  public static function delete() {
188
+
189
+ if ( !current_user_can( 'ure_delete_capabilities' ) ) {
190
+ return esc_html__( 'Insufficient permissions to work with User Role Editor','user-role-editor' );
 
 
 
 
191
  }
192
 
193
  $capabilities = URE_Capabilities::get_instance();
194
  $mess = '';
195
  $caps_allowed_to_remove = $capabilities->get_caps_to_remove();
196
+ if ( !is_array( $caps_allowed_to_remove ) || count( $caps_allowed_to_remove )==0 ) {
197
+ return esc_html__( 'There are no capabilities available for deletion!', 'user-role-editor' );
198
  }
199
 
200
+ $caps = self::get_caps_for_deletion_from_post( $caps_allowed_to_remove );
201
+ if ( empty($caps) ) {
202
+ return esc_html__( 'There are no capabilities available for deletion!', 'user-role-editor' );
203
  }
204
 
205
+ self::revoke_caps( $caps );
206
 
207
+ if ( count($caps)==1 ) {
208
+ $mess = sprintf( esc_html__( 'Capability %s was removed successfully', 'user-role-editor' ), $caps[0] );
209
  } else {
210
  $lib = URE_Lib::get_instance();
211
  $short_list_str = $lib->get_short_list_str( $caps );
212
+ $mess = count( $caps ) .' '. esc_html__( 'capabilities were removed successfully', 'user-role-editor' ) .': '.
213
  $short_list_str;
214
  }
215
 
216
+ return array('message'=>$mess, 'deleted_caps'=>$caps);
217
  }
218
  // end of delete()
219
 
includes/classes/editor.php CHANGED
@@ -195,7 +195,7 @@ class URE_Editor {
195
  // end of hide_pro_banner()
196
 
197
 
198
- protected function init_current_role_name() {
199
 
200
  $this->current_role = '';
201
  $this->current_role_name = '';
@@ -811,47 +811,53 @@ class URE_Editor {
811
  * @return string - message about operation result
812
  *
813
  */
814
- protected function add_new_role() {
815
 
816
- if (!current_user_can('ure_create_roles')) {
817
- return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
 
 
818
  }
819
 
820
  $result = $this->get_role_id_from_post();
821
  if ( !empty( $result['message'] ) ) {
822
- return $result['message'];
 
823
  }
824
 
825
  $role_id = $result['role_id'];
826
  $wp_roles = wp_roles();
827
  if ( isset( $wp_roles->roles[$role_id] ) ) {
828
- $message = sprintf( 'Error! ' . esc_html__('Role %s exists already', 'user-role-editor' ), $role_id);
829
- return $message;
830
  }
831
 
832
- $role_name = isset( $_POST['user_role_name'] ) ? $_POST['user_role_name'] : false;
833
- if ( !empty( $role_name ) ) {
834
- $role_name = sanitize_text_field( $role_name );
835
- } else {
836
  $role_name = $role_id; // as user role name is empty, use user role ID instead as a default value
837
  }
838
  $this->current_role = $role_id;
839
- $role_copy_from = isset($_POST['user_role_copy_from']) ? $_POST['user_role_copy_from'] : false;
840
- if ( !empty( $role_copy_from ) && $role_copy_from !== 'none' && $wp_roles->is_role( $role_copy_from ) ) {
841
  $role = $wp_roles->get_role($role_copy_from);
842
  $capabilities = $this->remove_caps_not_allowed_for_single_admin( $role->capabilities );
843
  } else {
844
- $capabilities = array('read' => true, 'level_0' => true); // User subscriber role permissions as a default value
845
  }
846
  // add new role to the roles array
847
- $result = add_role($role_id, $role_name, $capabilities);
848
  if ( !isset( $result ) || empty( $result ) ) {
849
- $message = 'Error! ' . esc_html__('Error is encountered during new role create operation', 'user-role-editor' );
850
- } else {
851
- $message = sprintf(esc_html__('Role %s is created successfully', 'user-role-editor'), $role_name );
852
- }
853
 
854
- return $message;
 
 
 
 
 
 
855
  }
856
  // end of add_new_role()
857
 
@@ -864,28 +870,31 @@ class URE_Editor {
864
  * @return string - message about operation result
865
  *
866
  */
867
- protected function rename_role() {
868
  global $wp_roles;
869
 
870
- if ( !current_user_can('ure_edit_roles') ) {
871
- return esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
 
 
872
  }
873
 
874
  $result = $this->get_role_id_from_post();
875
  if ( !empty( $result['message'] ) ) {
876
- return $result['message'];
 
877
  }
878
 
879
  $new_role_name = $this->lib->get_request_var('user_role_name', 'post' );
880
- if ( empty( $new_role_name ) ) {
881
- $message = esc_html__( 'Error: Empty role display name is not allowed.', 'user-role-editor' );
882
- return $message;
883
  }
884
 
885
  $role_id = $result['role_id'];
886
  $wp_roles = wp_roles();
887
  if ( !isset( $wp_roles->roles[$role_id] ) ) {
888
- $message = sprintf('Error! ' . esc_html__('Role %s does not exists', 'user-role-editor'), $role_id);
889
  return $message;
890
  }
891
 
@@ -897,9 +906,12 @@ class URE_Editor {
897
  $wp_roles->roles[$role_id]['name'] = $new_role_name;
898
  update_option( $wp_roles->role_key, $wp_roles->roles );
899
 
900
- $message = sprintf( esc_html__('Role %s is renamed to %s successfully', 'user-role-editor'), $old_role_name, $new_role_name );
 
 
 
901
 
902
- return $message;
903
  }
904
  // end of rename_role()
905
 
@@ -955,36 +967,27 @@ class URE_Editor {
955
  protected function delete_wp_roles( $roles_to_del ) {
956
  global $wp_roles;
957
 
958
- if ( !current_user_can('ure_delete_roles') ) {
959
- $message = esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
960
- return $message;
961
- }
962
-
963
- if ( empty($roles_to_del) || !is_array($roles_to_del) ) {
964
- $message = esc_html__('Empty or not valid list of roles for deletion','user-role-editor');
965
- return $message;
966
- }
967
-
968
  $roles_can_delete = $this->get_roles_can_delete();
969
  $wp_roles = wp_roles();
970
- $result = false;
971
  foreach($roles_to_del as $role_id) {
972
  if ( !isset( $wp_roles->roles[$role_id] ) ) {
973
- $message = esc_html__('Role does not exist','user-role-editor') .' - '.$role_id;
974
- return $message;
975
  }
976
  if ( !isset( $roles_can_delete[$role_id]) ) {
977
- $message = esc_html__('You can not delete role','user-role-editor') .' - '.$role_id;
978
- return $message;
979
  }
980
 
981
  unset( $wp_roles->role_objects[$role_id] );
982
  unset( $wp_roles->role_names[$role_id] );
983
  unset( $wp_roles->roles[$role_id] );
984
- $result = true;
 
985
  } // foreach()
986
- if ( $result ) {
987
- update_option( $wp_roles->role_key, $wp_roles->roles );
988
  }
989
 
990
  return $result;
@@ -995,8 +998,15 @@ class URE_Editor {
995
  protected function delete_all_unused_roles() {
996
 
997
  $roles_to_del = array_keys( $this->get_roles_can_delete() );
 
 
 
 
 
 
 
 
998
  $result = $this->delete_wp_roles( $roles_to_del );
999
- $this->roles = null; // to force roles refresh in User Role Editor
1000
 
1001
  return $result;
1002
  }
@@ -1007,35 +1017,40 @@ class URE_Editor {
1007
  * Process user request for user role deletion
1008
  * @return string
1009
  */
1010
- protected function delete_role() {
1011
-
 
1012
  if ( !current_user_can('ure_delete_roles') ) {
1013
- $message = esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
1014
- return $message;
1015
  }
1016
 
1017
  $role_id = $this->lib->get_request_var( 'user_role_id', 'post');
1018
  if ( $role_id==-1 ) { // delete all unused roles
1019
  $result = $this->delete_all_unused_roles();
1020
  } else {
 
 
 
 
1021
  $result = $this->delete_wp_roles( array( $role_id ) );
1022
  }
1023
- if ($result===true) {
 
 
1024
  if ( $role_id==-1 ) {
1025
- $message = esc_html__( 'Unused roles are deleted successfully', 'user-role-editor' );
1026
  } else {
1027
- $message = sprintf( esc_html__( 'Role %s is deleted successfully', 'user-role-editor' ), $role_id );
1028
  }
1029
- } elseif ( empty($result) ) {
1030
- $message = 'Error! '. esc_html__( 'Error encountered during role delete operation', 'user-role-editor' );
1031
  } else {
1032
- $message = $result;
1033
  }
1034
  if ( isset( $_POST['user_role_id'] ) ) {
1035
  unset( $_POST['user_role_id'] );
1036
  }
1037
 
1038
- return $message;
1039
  }
1040
  // end of delete_role()
1041
 
@@ -1109,20 +1124,6 @@ class URE_Editor {
1109
  $this->reset_user_roles();
1110
  exit;
1111
  }
1112
- case 'add-new-role': {
1113
- // process new role create request
1114
- $this->notification = $this->add_new_role();
1115
- break;
1116
- }
1117
- case 'rename-role': {
1118
- // process rename role request
1119
- $this->notification = $this->rename_role();
1120
- break;
1121
- }
1122
- case 'delete-role': {
1123
- $this->notification = $this->delete_role();
1124
- break;
1125
- }
1126
  case 'change-default-role': {
1127
  $this->notification = $this->change_default_role();
1128
  break;
@@ -1139,16 +1140,8 @@ class URE_Editor {
1139
  $this->hide_pro_banner();
1140
  break;
1141
  }
1142
- case 'add-new-capability': {
1143
- $this->notification = URE_Capability::add( $this->ure_object );
1144
- break;
1145
- }
1146
- case 'delete-user-capability': {
1147
- $this->notification = URE_Capability::delete();
1148
- break;
1149
- }
1150
  case 'roles_restore_note': {
1151
- $this->notification = esc_html__('User Roles are restored to WordPress default values. ', 'user-role-editor');
1152
  break;
1153
  }
1154
  case 'update': {
@@ -1156,7 +1149,7 @@ class URE_Editor {
1156
  break;
1157
  }
1158
  default: {
1159
- do_action('ure_process_user_request');
1160
  }
1161
  } // switch ( $action ) ....
1162
 
@@ -1165,7 +1158,7 @@ class URE_Editor {
1165
  // end of process_user_request()
1166
 
1167
 
1168
- protected function init1() {
1169
 
1170
  $this->roles = $this->lib->get_user_roles();
1171
  $this->full_capabilities = $this->lib->init_full_capabilities( $this->ure_object );
195
  // end of hide_pro_banner()
196
 
197
 
198
+ public function init_current_role_name() {
199
 
200
  $this->current_role = '';
201
  $this->current_role_name = '';
811
  * @return string - message about operation result
812
  *
813
  */
814
+ public function add_new_role() {
815
 
816
+ $response = array('result'=>'error', 'role_id'=>'', 'role_name'=>'', 'message'=>'');
817
+ if ( !current_user_can( 'ure_create_roles' ) ) {
818
+ $response['message'] = esc_html__( 'Insufficient permissions to work with User Role Editor','user-role-editor' );
819
+ return $response;
820
  }
821
 
822
  $result = $this->get_role_id_from_post();
823
  if ( !empty( $result['message'] ) ) {
824
+ $response['message'] = $result['message'];
825
+ return $response;
826
  }
827
 
828
  $role_id = $result['role_id'];
829
  $wp_roles = wp_roles();
830
  if ( isset( $wp_roles->roles[$role_id] ) ) {
831
+ $response['message'] = sprintf( 'Error! ' . esc_html__( 'Role %s exists already', 'user-role-editor' ), $role_id );
832
+ return $response;
833
  }
834
 
835
+ $role_name = $this->lib->get_request_var( 'user_role_name', 'post' );
836
+ if ( empty( $role_name ) ) {
 
 
837
  $role_name = $role_id; // as user role name is empty, use user role ID instead as a default value
838
  }
839
  $this->current_role = $role_id;
840
+ $role_copy_from = $this->lib->get_request_var( 'user_role_copy_from', 'post' );
841
+ if ( !empty( $role_copy_from ) && $role_copy_from!=='none' && $wp_roles->is_role( $role_copy_from ) ) {
842
  $role = $wp_roles->get_role($role_copy_from);
843
  $capabilities = $this->remove_caps_not_allowed_for_single_admin( $role->capabilities );
844
  } else {
845
+ $capabilities = array('read' => true, 'level_0' => true); // Use subscriber role permissions as a default value
846
  }
847
  // add new role to the roles array
848
+ $result = add_role( $role_id, $role_name, $capabilities );
849
  if ( !isset( $result ) || empty( $result ) ) {
850
+ $response['message'] = 'Error! ' . esc_html__('Error is encountered during new role create operation', 'user-role-editor' );
851
+ return $response;
852
+ }
 
853
 
854
+ $response['result'] = 'success';
855
+ $response['role_id'] = $role_id;
856
+ $response['role_name'] = $role_name;
857
+ $response['message'] = sprintf(esc_html__('Role %s is created successfully', 'user-role-editor'), $role_name );
858
+
859
+
860
+ return $response;
861
  }
862
  // end of add_new_role()
863
 
870
  * @return string - message about operation result
871
  *
872
  */
873
+ public function rename_role() {
874
  global $wp_roles;
875
 
876
+ $response = array('result'=>'error', 'message'=>'', 'role_id'=>'', 'role_name'=>'');
877
+ if ( !current_user_can( 'ure_edit_roles' ) ) {
878
+ $response['message'] = esc_html__( 'Insufficient permissions to work with User Role Editor','user-role-editor' );
879
+ return $response;
880
  }
881
 
882
  $result = $this->get_role_id_from_post();
883
  if ( !empty( $result['message'] ) ) {
884
+ $response['message'] = $result['message'];
885
+ return $response;
886
  }
887
 
888
  $new_role_name = $this->lib->get_request_var('user_role_name', 'post' );
889
+ if ( empty( $new_role_name ) ) {
890
+ $response['message'] = esc_html__( 'Error: Empty role display name is not allowed.', 'user-role-editor' );
891
+ return $response;
892
  }
893
 
894
  $role_id = $result['role_id'];
895
  $wp_roles = wp_roles();
896
  if ( !isset( $wp_roles->roles[$role_id] ) ) {
897
+ $response['message'] = sprintf('Error! ' . esc_html__('Role %s does not exists', 'user-role-editor'), $role_id);
898
  return $message;
899
  }
900
 
906
  $wp_roles->roles[$role_id]['name'] = $new_role_name;
907
  update_option( $wp_roles->role_key, $wp_roles->roles );
908
 
909
+ $response['result'] = 'success';
910
+ $response['message'] = sprintf( esc_html__('Role %s is renamed to %s successfully', 'user-role-editor'), $old_role_name, $new_role_name );
911
+ $response['role_id'] = $role_id;
912
+ $response['role_name'] = $new_role_name;
913
 
914
+ return $response;
915
  }
916
  // end of rename_role()
917
 
967
  protected function delete_wp_roles( $roles_to_del ) {
968
  global $wp_roles;
969
 
970
+ $result = array('result'=>false, 'deleted_roles'=>array(), 'message'=>'');
 
 
 
 
 
 
 
 
 
971
  $roles_can_delete = $this->get_roles_can_delete();
972
  $wp_roles = wp_roles();
 
973
  foreach($roles_to_del as $role_id) {
974
  if ( !isset( $wp_roles->roles[$role_id] ) ) {
975
+ $result['message'] = esc_html__('Role does not exist','user-role-editor') .' - '. $role_id;
976
+ return $result;
977
  }
978
  if ( !isset( $roles_can_delete[$role_id]) ) {
979
+ $result['message'] = esc_html__( 'You can not delete role', 'user-role-editor' ) .' - '.$role_id;
980
+ return $result;
981
  }
982
 
983
  unset( $wp_roles->role_objects[$role_id] );
984
  unset( $wp_roles->role_names[$role_id] );
985
  unset( $wp_roles->roles[$role_id] );
986
+ $result['deleted_roles'][] = $role_id;
987
+ $result['result'] = true;
988
  } // foreach()
989
+ if ( $result['result'] ) {
990
+ update_option( $wp_roles->role_key, $wp_roles->roles );
991
  }
992
 
993
  return $result;
998
  protected function delete_all_unused_roles() {
999
 
1000
  $roles_to_del = array_keys( $this->get_roles_can_delete() );
1001
+ if ( empty( $roles_to_del ) || !is_array( $roles_to_del ) ) {
1002
+ $result = array(
1003
+ 'result'=>false,
1004
+ 'deleted_roles'=>array(),
1005
+ 'message'=>esc_html__( 'There are no roles for deletion','user-role-editor' ));
1006
+ return $result;
1007
+ }
1008
+
1009
  $result = $this->delete_wp_roles( $roles_to_del );
 
1010
 
1011
  return $result;
1012
  }
1017
  * Process user request for user role deletion
1018
  * @return string
1019
  */
1020
+ public function delete_role() {
1021
+
1022
+ $response = array('result'=>'error', 'message'=>'', 'deleted_roles'=>array());
1023
  if ( !current_user_can('ure_delete_roles') ) {
1024
+ $response['message'] = esc_html__('Insufficient permissions to work with User Role Editor','user-role-editor');
1025
+ return $response;
1026
  }
1027
 
1028
  $role_id = $this->lib->get_request_var( 'user_role_id', 'post');
1029
  if ( $role_id==-1 ) { // delete all unused roles
1030
  $result = $this->delete_all_unused_roles();
1031
  } else {
1032
+ if ( empty( $role_id ) ) {
1033
+ $response['message'] = esc_html__( 'Wrong role ID','user-role-editor');
1034
+ return $response;
1035
+ }
1036
  $result = $this->delete_wp_roles( array( $role_id ) );
1037
  }
1038
+ if ( $result['result']===true ) {
1039
+ $response['result'] = 'success';
1040
+ $response['deleted_roles'] = $result['deleted_roles'];
1041
  if ( $role_id==-1 ) {
1042
+ $response['message'] = esc_html__( 'Unused roles are deleted successfully', 'user-role-editor' );
1043
  } else {
1044
+ $response['message'] = sprintf( esc_html__( 'Role %s is deleted successfully', 'user-role-editor' ), $role_id );
1045
  }
 
 
1046
  } else {
1047
+ $response['message'] = $result['message'];
1048
  }
1049
  if ( isset( $_POST['user_role_id'] ) ) {
1050
  unset( $_POST['user_role_id'] );
1051
  }
1052
 
1053
+ return $response;
1054
  }
1055
  // end of delete_role()
1056
 
1124
  $this->reset_user_roles();
1125
  exit;
1126
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1127
  case 'change-default-role': {
1128
  $this->notification = $this->change_default_role();
1129
  break;
1140
  $this->hide_pro_banner();
1141
  break;
1142
  }
 
 
 
 
 
 
 
 
1143
  case 'roles_restore_note': {
1144
+ $this->notification = esc_html__( 'User Roles are restored to WordPress default values. ', 'user-role-editor' );
1145
  break;
1146
  }
1147
  case 'update': {
1149
  break;
1150
  }
1151
  default: {
1152
+ do_action( 'ure_process_user_request' );
1153
  }
1154
  } // switch ( $action ) ....
1155
 
1158
  // end of process_user_request()
1159
 
1160
 
1161
+ public function init1() {
1162
 
1163
  $this->roles = $this->lib->get_user_roles();
1164
  $this->full_capabilities = $this->lib->init_full_capabilities( $this->ure_object );
includes/classes/role-view.php CHANGED
@@ -73,7 +73,7 @@ class URE_Role_View extends URE_View {
73
  $show_admin_role = $this->lib->show_admin_role_allowed();
74
  $this->role_to_copy_html = '<select id="user_role_copy_from" name="user_role_copy_from" style="width: '. $select_width .'px">
75
  <option value="none" selected="selected">' . esc_html__('None', 'user-role-editor') . '</option>';
76
- $this->role_select_html = '<select id="user_role" name="user_role" onchange="ure_role_change(this.value);">';
77
  $current_role = $this->editor->get( 'current_role' );
78
  $all_roles = $this->editor->get( 'roles' );
79
  $roles = $this->lib->get_editable_user_roles( $all_roles );
@@ -105,7 +105,7 @@ class URE_Role_View extends URE_View {
105
  $roles_can_delete = $this->editor->get_roles_can_delete();
106
  if ( is_array( $roles_can_delete ) && count( $roles_can_delete ) > 0) {
107
  ksort( $roles_can_delete );
108
- $this->role_delete_html = '<select id="del_user_role" name="del_user_role" width="200" style="width: 200px">';
109
  foreach ($roles_can_delete as $key => $value) {
110
  $this->role_delete_html .= '<option value="' . $key . '">' . esc_html__($value, 'user-role-editor') . '</option>';
111
  }
@@ -392,7 +392,7 @@ if ($multisite && !is_network_admin()) {
392
  ?>
393
  <div style="float: right; margin-left:10px; margin-right: 20px; <?php echo $fontColor; ?>" id="ure_apply_to_all_div">
394
  <input type="checkbox" name="ure_apply_to_all" id="ure_apply_to_all" value="1"
395
- <?php echo $checked; ?> title="<?php echo $hint; ?>" onclick="ure_apply_to_all_on_click(this)"/>
396
  <label for="ure_apply_to_all" title="<?php echo $hint; ?>"><?php esc_html_e('Apply to All Sites', 'user-role-editor'); ?></label>
397
  </div>
398
  <?php
73
  $show_admin_role = $this->lib->show_admin_role_allowed();
74
  $this->role_to_copy_html = '<select id="user_role_copy_from" name="user_role_copy_from" style="width: '. $select_width .'px">
75
  <option value="none" selected="selected">' . esc_html__('None', 'user-role-editor') . '</option>';
76
+ $this->role_select_html = '<select id="user_role" name="user_role" onchange="ure_main.role_change( this.value );">';
77
  $current_role = $this->editor->get( 'current_role' );
78
  $all_roles = $this->editor->get( 'roles' );
79
  $roles = $this->lib->get_editable_user_roles( $all_roles );
105
  $roles_can_delete = $this->editor->get_roles_can_delete();
106
  if ( is_array( $roles_can_delete ) && count( $roles_can_delete ) > 0) {
107
  ksort( $roles_can_delete );
108
+ $this->role_delete_html = '<select id="del_user_role" name="del_user_role" width="250" style="width: 250px">';
109
  foreach ($roles_can_delete as $key => $value) {
110
  $this->role_delete_html .= '<option value="' . $key . '">' . esc_html__($value, 'user-role-editor') . '</option>';
111
  }
392
  ?>
393
  <div style="float: right; margin-left:10px; margin-right: 20px; <?php echo $fontColor; ?>" id="ure_apply_to_all_div">
394
  <input type="checkbox" name="ure_apply_to_all" id="ure_apply_to_all" value="1"
395
+ <?php echo $checked; ?> title="<?php echo $hint; ?>" onclick="ure_main.apply_to_all_on_click(this)"/>
396
  <label for="ure_apply_to_all" title="<?php echo $hint; ?>"><?php esc_html_e('Apply to All Sites', 'user-role-editor'); ?></label>
397
  </div>
398
  <?php
includes/classes/user-role-editor.php CHANGED
@@ -181,9 +181,11 @@ class User_Role_Editor {
181
  if ($multisite) {
182
  $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
183
  if ($allow_edit_users_to_not_super_admin) {
184
- add_filter('map_meta_cap', array($this, 'restore_users_edit_caps'), 1, 4);
 
185
  remove_all_filters('enable_edit_any_user_configuration');
186
  add_filter('enable_edit_any_user_configuration', '__return_true');
 
187
  add_action('admin_head', array($this, 'edit_user_permission_check'), 1);
188
  if ($pagenow == 'user-new.php') {
189
  add_filter('site_option_site_admins', array($this, 'allow_add_user_as_superadmin'));
181
  if ($multisite) {
182
  $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
183
  if ($allow_edit_users_to_not_super_admin) {
184
+ // Make this as late as possible, to overwrite settings made by other plugins, like WooCommerce
185
+ add_filter('map_meta_cap', array($this, 'restore_users_edit_caps'), 99, 4);
186
  remove_all_filters('enable_edit_any_user_configuration');
187
  add_filter('enable_edit_any_user_configuration', '__return_true');
188
+ // make this as early as you can, to not provide superadmin privilege when it's not needed
189
  add_action('admin_head', array($this, 'edit_user_permission_check'), 1);
190
  if ($pagenow == 'user-new.php') {
191
  add_filter('site_option_site_admins', array($this, 'allow_add_user_as_superadmin'));
includes/classes/view.php CHANGED
@@ -125,29 +125,29 @@ class URE_View {
125
  // end of get_full_capabilities()
126
 
127
 
128
- /**
129
- * output HTML-code for capabilities list
 
130
  * @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
131
  * @param boolean $edit_mode - if false, capabilities checkboxes are shown as disable - readonly mode
132
  */
133
- public function show_capabilities($for_role = true, $edit_mode=true) {
134
-
135
  $onclick_for_admin = '';
136
- $multisite = $this->lib->get('multisite');
137
- $current_role = $this->editor->get('current_role');
138
- $user_to_edit = $this->editor->get('user_to_edit');
139
- $roles = $this->editor->get('roles');
140
  $full_capabilities = $this->get_full_capabilities();
141
  $built_in_wp_caps = $this->lib->get_built_in_wp_caps();
142
- $caps_readable = $this->editor->get('caps_readable');
143
  $caps_groups_manager = URE_Capabilities_Groups_Manager::get_instance();
144
 
145
  $key_capability = URE_Own_Capabilities::get_key_capability();
146
- $user_is_ure_admin = current_user_can($key_capability);
147
  $ure_caps = URE_Own_Capabilities::get_caps();
148
 
149
- $output = '<div id="ure_caps_list_container">'
150
- . '<div id="ure_caps_list">';
151
  foreach ($full_capabilities as $capability) {
152
  $cap_id = $capability['inner'];
153
  if (!$user_is_ure_admin) {
@@ -212,6 +212,23 @@ class URE_View {
212
 
213
  $output .= $cap_html;
214
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  $output .= '</div></div>' ;
216
 
217
  echo $output;
@@ -320,7 +337,7 @@ class URE_View {
320
  </div>
321
  <div class="ure-table-cell ure-caps-option nowrap">
322
  <?php esc_html_e('Columns:', 'user-role-editor');?>
323
- <select id="caps_columns_quant" name="caps_columns_quant" onchange="ure_change_caps_columns_quant();">
324
  <option value="1" <?php selected(1, $caps_columns_quant);?> >1</option>
325
  <option value="2" <?php selected(2, $caps_columns_quant);?> >2</option>
326
  <option value="3" <?php selected(3, $caps_columns_quant);?> >3</option>
125
  // end of get_full_capabilities()
126
 
127
 
128
+ /*
129
+ * Output HTML-code for capabilities list
130
+ * Used build output for response to AJAX request
131
  * @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
132
  * @param boolean $edit_mode - if false, capabilities checkboxes are shown as disable - readonly mode
133
  */
134
+ public function _show_capabilities( $for_role = true, $edit_mode=true ) {
 
135
  $onclick_for_admin = '';
136
+ $multisite = $this->lib->get( 'multisite' );
137
+ $current_role = $this->editor->get( 'current_role' );
138
+ $user_to_edit = $this->editor->get( 'user_to_edit' );
139
+ $roles = $this->editor->get( 'roles' );
140
  $full_capabilities = $this->get_full_capabilities();
141
  $built_in_wp_caps = $this->lib->get_built_in_wp_caps();
142
+ $caps_readable = $this->editor->get( 'caps_readable' );
143
  $caps_groups_manager = URE_Capabilities_Groups_Manager::get_instance();
144
 
145
  $key_capability = URE_Own_Capabilities::get_key_capability();
146
+ $user_is_ure_admin = current_user_can( $key_capability );
147
  $ure_caps = URE_Own_Capabilities::get_caps();
148
 
149
+ $output = '';
150
+
151
  foreach ($full_capabilities as $capability) {
152
  $cap_id = $capability['inner'];
153
  if (!$user_is_ure_admin) {
212
 
213
  $output .= $cap_html;
214
  }
215
+
216
+ return $output;
217
+ }
218
+ // end of _show_capabilities()
219
+
220
+
221
+ /**
222
+ * Output HTML-code for capabilities list
223
+ * Used to built full page output for usual HTTP request
224
+ * @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
225
+ * @param boolean $edit_mode - if false, capabilities checkboxes are shown as disable - readonly mode
226
+ */
227
+ public function show_capabilities( $for_role = true, $edit_mode=true ) {
228
+
229
+ $output = '<div id="ure_caps_list_container">'
230
+ . '<div id="ure_caps_list">';
231
+ $output .= $this->_show_capabilities( $for_role, $edit_mode );
232
  $output .= '</div></div>' ;
233
 
234
  echo $output;
337
  </div>
338
  <div class="ure-table-cell ure-caps-option nowrap">
339
  <?php esc_html_e('Columns:', 'user-role-editor');?>
340
+ <select id="caps_columns_quant" name="caps_columns_quant" onchange="ure_main.change_caps_columns_quant();">
341
  <option value="1" <?php selected(1, $caps_columns_quant);?> >1</option>
342
  <option value="2" <?php selected(2, $caps_columns_quant);?> >2</option>
343
  <option value="3" <?php selected(3, $caps_columns_quant);?> >3</option>
js/ure.js CHANGED
@@ -20,150 +20,422 @@
20
  });
21
  })(jQuery);
22
 
23
- var ure_ajax_get_caps_to_remove = null;
24
 
25
  jQuery(document).ready(function() {
26
-
27
- // Get from the server a list of capabilities we can delete and show dialog to select what to delete
28
- ure_ajax_get_caps_to_remove = {
29
- url: ajaxurl,
30
- type: 'POST',
31
- dataType: 'html',
32
- data: {
33
- action: 'ure_ajax',
34
- sub_action: 'get_caps_to_remove',
35
- current_role: jQuery('#user_role').val(),
36
- network_admin: ure_data.network_admin,
37
- wp_nonce: ure_data.wp_nonce
38
- },
39
- success: function (response) {
40
- var data = jQuery.parseJSON(response);
41
- if (typeof data.result !== 'undefined') {
42
- if (data.result === 'success') {
43
- jQuery('#ure_delete_capability_dialog .ure-input').html(data.html);
44
- ure_main.show_delete_capability_dialog();
45
- } else if (data.result === 'failure') {
46
- alert(data.message);
47
- } else {
48
- alert('Wrong response: ' + response)
49
- }
50
- } else {
51
- alert('Wrong response: ' + response)
52
- }
53
- },
54
- error: function (XMLHttpRequest, textStatus, exception) {
55
- alert("Ajax failure\n" + XMLHttpRequest.statusText);
56
- },
57
- async: true
58
- };
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  });
61
 
 
62
  // Main User Role Editor object
63
  var ure_main = {
64
  selected_group: 'all',
65
  caps_counter: null,
66
  class_prefix: 'ure-',
67
-
68
- show_delete_capability_dialog: function () {
69
- jQuery('#ure_delete_capability_dialog').dialog({
70
- dialogClass: 'wp-dialog',
71
- modal: true,
72
- autoOpen: true,
73
- closeOnEscape: true,
74
- width: 350,
75
- height: 400,
76
- resizable: false,
77
- title: ure_data.delete_capability,
78
- buttons: {
79
- 'Delete Capability': function () {
80
- if (!confirm(ure_data.delete_capability + ' - ' + ure_data.delete_capability_warning)) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  return;
82
- }
83
- jQuery('#ure_remove_caps_form').submit();
84
- jQuery(this).dialog('close');
85
- },
86
- CancelDeleteCapability: function () {
87
- jQuery(this).dialog('close');
 
 
 
 
 
 
 
 
 
 
 
 
88
  }
89
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  });
91
- // translate buttons caption
92
- jQuery('.ui-dialog-buttonpane button:contains("Delete Capability")').attr('id', 'dialog-delete-capability-button');
93
- jQuery('#dialog-delete-capability-button').html(ure_ui_button_text(ure_data.delete_capability));
94
- jQuery('.ui-dialog-buttonpane button:contains("CancelDeleteCapability")').attr('id', 'delete-capability-dialog-cancel-button');
95
- jQuery('#delete-capability-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
96
- jQuery('#ure_remove_caps_select_all').click(this.remove_caps_auto_select);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  },
98
 
99
- remove_caps_auto_select: function (event) {
100
- if (event.shiftKey) {
101
- jQuery('.ure-cb-column').each(function () { // reverse selection
102
- jQuery(this).prop('checked', !jQuery(this).prop('checked'));
103
- });
104
- } else { // switch On/Off all checkboxes
105
- jQuery('.ure-cb-column').prop('checked', jQuery('#ure_remove_caps_select_all').prop('checked'));
106
 
107
- }
108
- }
 
 
109
 
110
- }; // end of ure_main declaration
111
- //-------------------------------
112
 
 
 
113
 
 
 
114
 
115
- function ure_ui_button_text(caption) {
116
- var wrapper = '<span class="ui-button-text">' + caption + '</span>';
117
 
118
- return wrapper;
119
- }
 
 
 
120
 
 
 
 
 
 
 
 
 
 
121
 
122
- function ure_select_selectable_element(selectable_container, elements_to_select) {
123
- // add unselecting class to all elements in the styleboard canvas except the ones to select
124
- jQuery(".ui-selected", selectable_container).not(elements_to_select).removeClass("ui-selected").addClass("ui-unselecting");
125
- // add ui-selecting class to the elements to select
126
- jQuery(elements_to_select).not(".ui-selected").addClass("ui-selecting");
127
- // trigger the mouse stop event (this will select all .ui-selecting elements, and deselect all .ui-unselecting elements)
128
- selectable_container.data("ui-selectable")._mouseStop(null);
129
- }
130
 
 
 
 
 
 
 
 
 
 
131
 
132
- jQuery(function ($) {
133
 
134
- ure_count_caps_in_groups();
135
- ure_sizes_update();
136
- if ($('#ure_select_all_caps').length>0) {
137
- $('#ure_select_all_caps').click(ure_auto_select_caps);
138
- }
139
- $('#granted_only').click(ure_show_granted_caps_only);
140
- $('#ure_caps_groups_list').selectable({
141
- selected: function( event, ui ) {
142
- // do not allow multiple selection
143
- $(ui.selected).siblings().removeClass("ui-selected");
144
- ure_caps_refresh(ui.selected.id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  }
146
- });
147
- ure_select_selectable_element($('#ure_caps_groups_list'), $('#ure_caps_group_all'));
148
 
149
- $('#ure_update_role').button({
150
- label: ure_data.update
151
- }).click(function () {
152
- if (ure_data.confirm_role_update == 1) {
153
- event.preventDefault();
154
- ure_confirm(ure_data.confirm_submit, ure_form_submit);
155
  }
156
- });
157
 
 
 
 
 
 
 
158
 
159
- function ure_form_submit() {
160
- $('#ure_form').submit();
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
 
 
 
 
 
 
 
163
 
164
- function ure_show_add_role_dialog() {
 
 
 
165
 
166
- $('#ure_add_role_dialog').dialog({
167
  dialogClass: 'wp-dialog',
168
  modal: true,
169
  autoOpen: true,
@@ -174,95 +446,307 @@ jQuery(function ($) {
174
  title: ure_data.add_new_role_title,
175
  'buttons': {
176
  'Add Role': function () {
177
- var role_id = $('#user_role_id').val();
178
- if (role_id == '') {
179
- alert(ure_data.role_name_required);
180
  return false;
181
  }
182
- if (!(/^[\w-]*$/.test(role_id))) {
183
- alert(ure_data.role_name_valid_chars);
184
  return false;
185
  }
186
- if ((/^[0-9]*$/.test(role_id))) {
187
- alert(ure_data.numeric_role_name_prohibited);
188
  return false;
189
  }
190
- var role_name = $('#user_role_name').val();
191
- var role_copy_from = $('#user_role_copy_from').val();
192
-
193
- $(this).dialog('close');
194
- $.ure_postGo(ure_data.page_url,
195
- {action: 'add-new-role', user_role_id: role_id, user_role_name: role_name, user_role_copy_from: role_copy_from,
196
- ure_nonce: ure_data.wp_nonce});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  },
198
  CancelAddRole: function () {
199
- $(this).dialog('close');
200
  return false;
201
  }
202
  }
203
  });
204
- $('.ui-dialog-buttonpane button:contains("Add Role")').attr('id', 'dialog-add-role-button');
205
- $('#dialog-add-role-button').html(ure_ui_button_text(ure_data.add_role));
206
- $('.ui-dialog-buttonpane button:contains("CancelAddRole")').attr('id', 'dialog-add-role-cancel-button');
207
- $('#dialog-add-role-cancel-button').html(ure_ui_button_text(ure_data.cancel));
208
 
209
- }
210
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
 
212
- $('#ure_add_role').button({
213
- label: ure_data.add_role
214
- }).click(function (event) {
215
- event.preventDefault();
216
- ure_show_add_role_dialog();
217
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
- function ure_show_rename_role_dialog() {
221
 
222
- $('#ure_rename_role_dialog').dialog({
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  dialogClass: 'wp-dialog',
224
  modal: true,
225
  autoOpen: true,
226
  closeOnEscape: true,
227
- width: 450,
228
- height: 230,
229
  resizable: false,
230
- title: ure_data.rename_role_title,
231
- 'buttons': {
232
- 'Rename Role': function () {
233
- var role_id = $('#ren_user_role_id').val();
234
- var role_name = $('#ren_user_role_name').val();
235
- $(this).dialog('close');
236
- $.ure_postGo(ure_data.page_url,
237
- {action: 'rename-role', user_role_id: role_id, user_role_name: role_name, ure_nonce: ure_data.wp_nonce}
238
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  },
240
- CancelRenameRole: function () {
241
- $(this).dialog('close');
242
- return false;
243
  }
244
  }
245
  });
246
- $('.ui-dialog-buttonpane button:contains("Rename Role")').attr('id', 'dialog-rename-role-button');
247
- $('#dialog-rename-role-button').html(ure_ui_button_text(ure_data.rename_role));
248
- $('.ui-dialog-buttonpane button:contains("CancelRenameRole")').attr('id', 'rename-role-dialog-cancel-button');
249
- $('#rename-role-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
250
- $('#ren_user_role_id').val(ure_current_role);
251
- $('#ren_user_role_name').val(ure_current_role_name);
252
-
253
- }
254
-
255
-
256
- $('#ure_rename_role').button({
257
- label: ure_data.rename_role
258
- }).click(function (event) {
259
- event.preventDefault();
260
- ure_show_rename_role_dialog();
261
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
 
263
-
264
- function ure_show_delete_role_dialog() {
265
- $('#ure_delete_role_dialog').dialog({
 
 
 
266
  dialogClass: 'wp-dialog',
267
  modal: true,
268
  autoOpen: true,
@@ -273,97 +757,177 @@ jQuery(function ($) {
273
  title: ure_data.delete_role,
274
  buttons: {
275
  'Delete Role': function () {
276
- var user_role_id = $('#del_user_role').val();
277
  var question = '';
278
  if (user_role_id!=-1) {
279
  question = ure_data.delete_role +' "'+ user_role_id +'"';
280
  } else {
281
- question = $('#del_user_role').find('option:selected').text();
282
  }
283
  question += '?';
284
- if (!confirm(question)) {
285
  return false;
286
  }
287
- $(this).dialog('close');
288
- $.ure_postGo(ure_data.page_url,
289
- {action: 'delete-role', user_role_id: user_role_id, ure_nonce: ure_data.wp_nonce});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
290
  },
291
  CancelDeleteRole: function () {
292
- $(this).dialog('close');
293
  }
294
  }
295
  });
296
  // translate buttons caption
297
- $('.ui-dialog-buttonpane button:contains("Delete Role")').attr('id', 'dialog-delete-role-button');
298
- $('#dialog-delete-role-button').html( ure_ui_button_text( ure_data.delete_role ) );
299
- $('.ui-dialog-buttonpane button:contains("CancelDeleteRole")').attr('id', 'dialog-delete-role-cancel-button');
300
- $('#dialog-delete-role-cancel-button').html( ure_ui_button_text( ure_data.cancel ) );
301
- }
302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
303
 
304
- $('#ure_delete_role').button({
305
- label: ure_data.delete_role
306
- }).click(function (event) {
307
- event.preventDefault();
308
- ure_show_delete_role_dialog();
309
- });
310
-
311
-
312
- function ure_show_add_capability_dialog() {
313
- $('#ure_add_capability_dialog').dialog({
314
  dialogClass: 'wp-dialog',
315
  modal: true,
316
  autoOpen: true,
317
  closeOnEscape: true,
318
- width: 350,
319
- height: 190,
320
  resizable: false,
321
- title: ure_data.add_capability,
322
  'buttons': {
323
- 'Add Capability': function () {
324
- var capability_id = $('#capability_id').val();
325
- if (capability_id == '') {
326
- alert(ure_data.capability_name_required);
327
- return false;
328
- }
329
- if (!(/^[\w-]*$/.test(capability_id))) {
330
- alert(ure_data.capability_name_valid_chars);
331
- return false;
332
- }
333
-
334
- $(this).dialog('close');
335
- $.ure_postGo(ure_data.page_url,
336
- {action: 'add-new-capability', capability_id: capability_id, ure_nonce: ure_data.wp_nonce});
 
 
 
 
 
 
 
 
 
 
 
 
337
  },
338
- CancelAddCapability: function () {
339
- $(this).dialog('close');
 
340
  }
341
  }
342
  });
343
- $('.ui-dialog-buttonpane button:contains("Add Capability")').attr('id', 'dialog-add-capability-button');
344
- $('#dialog-add-capability-button').html(ure_ui_button_text(ure_data.add_capability));
345
- $('.ui-dialog-buttonpane button:contains("CancelAddCapability")').attr('id', 'add-capability-dialog-cancel-button');
346
- $('#add-capability-dialog-cancel-button').html(ure_ui_button_text(ure_data.cancel));
 
 
 
 
 
 
 
347
 
348
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
349
 
350
 
351
- $('#ure_add_capability').button({
352
- label: ure_data.add_capability
353
- }).click(function (event) {
354
- event.preventDefault();
355
- ure_show_add_capability_dialog();
356
- });
357
-
358
 
359
- if ($('#ure_delete_capability').length > 0) {
360
- $('#ure_delete_capability').button({
361
- label: ure_data.delete_capability
362
- }).click(function (event) {
 
 
 
 
 
 
 
 
 
363
  event.preventDefault();
364
- $.ajax(ure_ajax_get_caps_to_remove);
365
- });
366
- }
 
 
 
 
 
367
 
368
 
369
  function ure_show_default_role_dialog() {
@@ -444,18 +1008,6 @@ jQuery(function ($) {
444
  // end of jQuery(function() ...
445
 
446
 
447
- // change color of apply to all check box - for multi-site setup only
448
- function ure_apply_to_all_on_click(cb) {
449
- el = document.getElementById('ure_apply_to_all_div');
450
- if (cb.checked) {
451
- el.style.color = '#FF0000';
452
- } else {
453
- el.style.color = '#000000';
454
- }
455
- }
456
- // end of ure_apply_to_all_on_click()
457
-
458
-
459
  // turn on checkbox back if clicked to turn off - for 'administrator' role only!
460
  function ure_turn_it_back( event ) {
461
 
@@ -467,42 +1019,6 @@ function ure_turn_it_back( event ) {
467
  // end of ure_turn_it_back()
468
 
469
 
470
- function ure_apply_selection(cb_id) {
471
- var qfilter = jQuery('#quick_filter').val();
472
- var parent_div = jQuery('#ure_cap_div_'+ cb_id);
473
- var disabled = jQuery('#'+ cb_id).attr('disabled');
474
- var result = false;
475
- if (parent_div.hasClass(ure_main.class_prefix + ure_main.selected_group) && // make selection inside currently selected group of capabilities only
476
- !parent_div.hasClass('hidden') && disabled!=='disabled') { // select not hidden and not disabled checkboxes (capabilities) only
477
- // if quick filter is not empty, then apply selection to the tagged element only
478
- if (qfilter==='' || parent_div.hasClass('ure_tag')) {
479
- result = true;
480
- }
481
- }
482
-
483
- return result;
484
- }
485
-
486
-
487
- function ure_auto_select_caps(event) {
488
-
489
- if (event.shiftKey) {
490
- jQuery('.ure-cap-cb').each(function () { // reverse selection
491
- if (ure_apply_selection(this.id)) {
492
- jQuery(this).prop('checked', !jQuery(this).prop('checked'));
493
- }
494
- });
495
- } else {
496
- jQuery('.ure-cap-cb').each(function () { // switch On/Off all checkboxes
497
- if (ure_apply_selection(this.id)) {
498
- jQuery(this).prop('checked', jQuery('#ure_select_all_caps').prop('checked'));
499
- }
500
- });
501
- }
502
-
503
- }
504
-
505
-
506
  function ure_turn_caps_readable(user_id) {
507
  var ure_obj = 'user';
508
  if (user_id === 0) {
@@ -527,66 +1043,6 @@ function ure_turn_deprecated_caps(user_id) {
527
  // ure_turn_deprecated_caps()
528
 
529
 
530
- function ure_refresh_role_view(response) {
531
- jQuery('#ure_task_status').hide();
532
- if (response!==null && response.result=='error') {
533
- alert(response.message);
534
- return;
535
- }
536
-
537
- // remove "Granted Only" filter is it was set before current role change
538
- var granted_only = jQuery('#granted_only').prop('checked');
539
- if (granted_only) {
540
- jQuery('#granted_only').prop('checked', false);
541
- ure_show_granted_caps_only();
542
- }
543
-
544
- ure_current_role = response.role_id;
545
- ure_current_role_name = response.role_name;
546
- // Select capabilities granted to a newly selected role and exclude others
547
- jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes
548
- if (this.id.length===0) {
549
- return;
550
- }
551
- jQuery(this).prop('checked', response.caps.hasOwnProperty(this.id) && response.caps[this.id]);
552
- if ( ure_data.do_not_revoke_from_admin==1 ) {
553
- var el = document.getElementById(this.id);
554
- if ( 'administrator'===ure_current_role ) {
555
- el.addEventListener( 'click', ure_turn_it_back );
556
- } else {
557
- el.removeEventListener( 'click', ure_turn_it_back );
558
- }
559
- }
560
- });
561
-
562
- // Recalculate granted capabilities for capabilities groups
563
- ure_count_caps_in_groups();
564
- ure_select_selectable_element(jQuery('#ure_caps_groups_list'), jQuery('#ure_caps_group_all'));
565
-
566
- // additional options section
567
- jQuery('#additional_options').find(':checkbox').each(function() { // go through all additional options checkboxes
568
- jQuery(this).prop('checked', response.options.hasOwnProperty(this.id));
569
- });
570
-
571
- }
572
- // end of refresh_role_view()
573
-
574
-
575
- function ure_role_change(role_name) {
576
-
577
- //jQuery.ure_postGo(ure_data.page_url, {action: 'role-change', object: 'role', user_role: role_name, ure_nonce: ure_data.wp_nonce});
578
- jQuery('#ure_task_status').show();
579
- var data = {
580
- 'action': 'ure_ajax',
581
- 'sub_action':'get_role_caps',
582
- 'role': role_name,
583
- 'wp_nonce': ure_data.wp_nonce};
584
- jQuery.post(ajaxurl, data, ure_refresh_role_view, 'json');
585
-
586
- }
587
- // end of ure_role_change()
588
-
589
-
590
  function ure_filter_capabilities(cap_id) {
591
  var div_list = jQuery('.ure-cap-div');
592
  for (var i = 0; i < div_list.length; i++) {
@@ -611,170 +1067,6 @@ function ure_hide_pro_banner() {
611
  // end of ure_hide_this_banner()
612
 
613
 
614
- function ure_caps_refresh_all() {
615
- jQuery('.ure-cap-div').each(function () {
616
- if (jQuery(this).hasClass('hidden')) {
617
- if (!jQuery(this).hasClass(ure_main.class_prefix + 'deprecated')) {
618
- jQuery(this).removeClass('hidden');
619
- }
620
- }
621
- });
622
- }
623
-
624
-
625
- function ure_caps_refresh_for_group(group_id) {
626
- var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
627
- jQuery('.ure-cap-div').each(function () {
628
- var el = jQuery(this);
629
- if (el.hasClass(ure_main.class_prefix + group_id)) {
630
- if (el.hasClass('hidden')) {
631
- if (el.hasClass('blocked')) {
632
- return;
633
- }
634
- if (el.hasClass(ure_main.class_prefix + 'deprecated')) {
635
- if (group_id==='deprecated' || show_deprecated) {
636
- el.removeClass('hidden');
637
- }
638
- } else {
639
- el.removeClass('hidden');
640
- }
641
- } else {
642
- if (el.hasClass(ure_main.class_prefix + 'deprecated')) {
643
- if (!show_deprecated) {
644
- el.addClass('hidden');
645
- }
646
- }
647
- }
648
- } else {
649
- if (!el.hasClass('hidden')) {
650
- el.addClass('hidden');
651
- }
652
- }
653
- });
654
- }
655
-
656
-
657
- function ure_caps_refresh(group) {
658
-
659
- var group_id = group.substr(15);
660
- ure_main.selected_group = group_id;
661
- if (group_id === 'all') {
662
- ure_caps_refresh_all();
663
- } else {
664
- ure_caps_refresh_for_group(group_id);
665
- }
666
- ure_change_caps_columns_quant();
667
- jQuery('#granted_only').attr('checked', false);
668
- }
669
-
670
-
671
- function ure_validate_columns(columns) {
672
- if (columns==1 || ure_main.selected_group==='all') {
673
- return columns;
674
- }
675
-
676
- // Do not split list on columns in case it contains less then < 25 capabilities
677
- for (var i=0; i<ure_main.caps_counter.length; i++) {
678
- if (ure_main.caps_counter[i].id===ure_main.selected_group) {
679
- if (ure_main.caps_counter[i].total<=25) {
680
- columns = 1;
681
- }
682
- break;
683
- }
684
- }
685
-
686
- return columns;
687
- }
688
-
689
-
690
- function ure_change_caps_columns_quant() {
691
- var selected_index = parseInt(jQuery('#caps_columns_quant').val());
692
- var columns = ure_validate_columns(selected_index);
693
- var el = jQuery('#ure_caps_list');
694
- el.css('-moz-column-count', columns);
695
- el.css('-webkit-column-count', columns);
696
- el.css('column-count', columns);
697
-
698
- }
699
-
700
-
701
- function ure_init_caps_counter() {
702
- ure_main.caps_counter = new Array();
703
- jQuery('#ure_caps_groups_list li').each(function() {
704
- var group_id = jQuery(this).attr('id').substr(15);
705
- var group_counter = {'id': group_id, 'total': 0, 'granted':0};
706
- ure_main.caps_counter.push(group_counter);
707
- });
708
-
709
- }
710
-
711
-
712
- function ure_count_caps_in_groups() {
713
- ure_init_caps_counter();
714
-
715
- jQuery('.ure-cap-div').each(function () {
716
- var cap_div = jQuery(this);
717
- var capability = cap_div.attr('id').substr(12);
718
- for (var i=0; i<ure_main.caps_counter.length; i++) {
719
- if (cap_div.hasClass(ure_main.class_prefix + ure_main.caps_counter[i].id)) {
720
- ure_main.caps_counter[i].total++;
721
- if (jQuery('#'+ capability).is(':checked')) {
722
- ure_main.caps_counter[i].granted++;
723
- }
724
- }
725
- }
726
- });
727
-
728
- for (var i=0; i<ure_main.caps_counter.length; i++) {
729
- var el = jQuery('#ure_caps_group_'+ ure_main.caps_counter[i].id);
730
- var old_text = el.text();
731
- var key_pos = old_text.indexOf('('); // exclude (0/0) text if it is in string already
732
- if (key_pos>0) {
733
- old_text = old_text.substr(0, key_pos - 1);
734
- }
735
- var value = old_text +' ('+ ure_main.caps_counter[i].total +'/'+ ure_main.caps_counter[i].granted +')';
736
-
737
- el.text(value);
738
- }
739
-
740
- }
741
-
742
-
743
- function ure_sizes_update() {
744
- var width = jQuery('#ure_caps_td').css('width');
745
- jQuery('#ure_caps_list_container').css('width', width);
746
- }
747
-
748
-
749
  jQuery(window).resize(function () {
750
- ure_sizes_update();
751
  });
752
-
753
-
754
- function ure_show_granted_caps_only() {
755
- var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
756
- var hide_flag = jQuery('#granted_only').attr('checked');
757
- jQuery('.ure-cap-div').each(function () {
758
- var cap_div = jQuery(this);
759
- if (!cap_div.hasClass(ure_main.class_prefix + ure_main.selected_group)) { // apply to the currently selected group only
760
- return;
761
- }
762
- var cap_id = cap_div.attr('id').substr(12);
763
- var granted = jQuery('#'+ cap_id).attr('checked');
764
- if (granted) {
765
- return;
766
- }
767
- if (hide_flag) {
768
- if (!cap_div.hasClass('hidden')) {
769
- cap_div.addClass('hidden');
770
- }
771
- } else {
772
- if (cap_div.hasClass('ure-deprecated') && !show_deprecated) {
773
- return;
774
- }
775
- if (cap_div.hasClass('hidden')) {
776
- cap_div.removeClass('hidden');
777
- }
778
- }
779
- });
780
- }
20
  });
21
  })(jQuery);
22
 
 
23
 
24
  jQuery(document).ready(function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ jQuery( '#ure_add_role' ).button({
27
+ label: ure_data.add_role
28
+ }).click(function ( event ) {
29
+ event.preventDefault();
30
+ ure_main.show_add_role_dialog();
31
+ });
32
+
33
+ jQuery( '#ure_add_capability' ).button({
34
+ label: ure_data.add_capability
35
+ }).click( function ( event ) {
36
+ event.preventDefault();
37
+ ure_main.show_add_capability_dialog();
38
+ });
39
+
40
+ var del_cap = jQuery( '#ure_delete_capability' );
41
+ if ( del_cap.length > 0 ) {
42
+ del_cap.button({
43
+ label: ure_data.delete_capability
44
+ }).click(function ( event ) {
45
+ event.preventDefault();
46
+ jQuery.ajax( ure_main.get_caps_to_remove );
47
+ });
48
+ }
49
+
50
+ var del_role = jQuery( '#ure_delete_role' );
51
+ if ( del_role.length>0 ) {
52
+ del_role.button({
53
+ label: ure_data.delete_role
54
+ }).click(function ( event ) {
55
+ event.preventDefault();
56
+ ure_main.show_delete_role_dialog();
57
+ });
58
+ }
59
+
60
+ jQuery('#ure_rename_role').button({
61
+ label: ure_data.rename_role
62
+ }).click(function (event) {
63
+ event.preventDefault();
64
+ ure_main.show_rename_role_dialog();
65
+ });
66
+
67
+
68
+
69
+ if ( jQuery('#ure_select_all_caps').length>0 ) {
70
+ jQuery('#ure_select_all_caps').click( ure_main.auto_select_caps );
71
+ }
72
+
73
+ ure_main.count_caps_in_groups();
74
+ ure_main.sizes_update();
75
+ jQuery('#ure_caps_groups_list').selectable({
76
+ selected: function( event, ui ) {
77
+ // do not allow multiple selection
78
+ jQuery(ui.selected).siblings().removeClass('ui-selected');
79
+ ure_main.caps_refresh( ui.selected.id );
80
+ }
81
+ });
82
+ ure_main.select_selectable_element( jQuery('#ure_caps_groups_list'), jQuery('#ure_caps_group_all') );
83
+ jQuery('#granted_only').click( ure_main.show_granted_caps_only );
84
+
85
  });
86
 
87
+
88
  // Main User Role Editor object
89
  var ure_main = {
90
  selected_group: 'all',
91
  caps_counter: null,
92
  class_prefix: 'ure-',
93
+
94
+
95
+ ajax_error: function ( jqXHR, textStatus, errorThrown) {
96
+ jQuery('#ure_task_status').hide();
97
+ ure_main.show_notice( textStatus, 'error' );
98
+ },
99
+
100
+
101
+ // change color of apply to all check box - for multi-site setup only
102
+ apply_to_all_on_click: function (cb) {
103
+ el = document.getElementById('ure_apply_to_all_div');
104
+ if (cb.checked) {
105
+ el.style.color = '#FF0000';
106
+ } else {
107
+ el.style.color = '#000000';
108
+ }
109
+ },
110
+
111
+
112
+ apply_selection: function (cb_id) {
113
+ var qfilter = jQuery('#quick_filter').val();
114
+ var parent_div = jQuery('#ure_cap_div_'+ cb_id);
115
+ var disabled = jQuery('#'+ cb_id).attr('disabled');
116
+ var result = false;
117
+ if ( parent_div.hasClass( ure_main.class_prefix + ure_main.selected_group ) && // make selection inside currently selected group of capabilities only
118
+ !parent_div.hasClass('hidden') && disabled!=='disabled' ) { // select not hidden and not disabled checkboxes (capabilities) only
119
+ // if quick filter is not empty, then apply selection to the tagged element only
120
+ if ( qfilter==='' || parent_div.hasClass('ure_tag') ) {
121
+ result = true;
122
+ }
123
+ }
124
+
125
+ return result;
126
+ },
127
+
128
+
129
+ auto_select_caps: function (event) {
130
+
131
+ if ( event.shiftKey ) {
132
+ jQuery('.ure-cap-cb').each(function () { // reverse selection
133
+ if ( ure_main.apply_selection( this.id ) ) {
134
+ jQuery(this).prop('checked', !jQuery(this).prop('checked'));
135
+ }
136
+ });
137
+ } else {
138
+ jQuery('.ure-cap-cb').each(function () { // switch On/Off all checkboxes
139
+ if ( ure_main.apply_selection( this.id ) ) {
140
+ jQuery(this).prop('checked', jQuery('#ure_select_all_caps').prop('checked'));
141
+ }
142
+ });
143
+ }
144
+
145
+ },
146
+
147
+
148
+ caps_refresh_all: function () {
149
+ jQuery('.ure-cap-div').each(function () {
150
+ if (jQuery(this).hasClass('hidden')) {
151
+ if ( !jQuery(this).hasClass(ure_main.class_prefix + 'deprecated') ) {
152
+ jQuery(this).removeClass('hidden');
153
+ }
154
+ }
155
+ });
156
+ },
157
+
158
+
159
+ caps_refresh_for_group: function (group_id) {
160
+ var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
161
+ jQuery('.ure-cap-div').each(function () {
162
+ var el = jQuery(this);
163
+ if (el.hasClass(ure_main.class_prefix + group_id)) {
164
+ if (el.hasClass('hidden')) {
165
+ if (el.hasClass('blocked')) {
166
  return;
167
+ }
168
+ if (el.hasClass(ure_main.class_prefix + 'deprecated')) {
169
+ if (group_id==='deprecated' || show_deprecated) {
170
+ el.removeClass('hidden');
171
+ }
172
+ } else {
173
+ el.removeClass('hidden');
174
+ }
175
+ } else {
176
+ if (el.hasClass(ure_main.class_prefix + 'deprecated')) {
177
+ if (!show_deprecated) {
178
+ el.addClass('hidden');
179
+ }
180
+ }
181
+ }
182
+ } else {
183
+ if (!el.hasClass('hidden')) {
184
+ el.addClass('hidden');
185
  }
186
  }
187
+ });
188
+ },
189
+
190
+
191
+ change_caps_columns_quant: function () {
192
+ var selected_index = parseInt( jQuery('#caps_columns_quant').val() );
193
+ var columns = ure_main.validate_columns( selected_index );
194
+ var el = jQuery('#ure_caps_list');
195
+ el.css('-moz-column-count', columns);
196
+ el.css('-webkit-column-count', columns);
197
+ el.css('column-count', columns);
198
+
199
+ },
200
+
201
+
202
+ caps_refresh: function ( group ) {
203
+
204
+ var group_id = group.substr(15);
205
+ ure_main.selected_group = group_id;
206
+ if (group_id === 'all') {
207
+ ure_main.caps_refresh_all();
208
+ } else {
209
+ ure_main.caps_refresh_for_group( group_id );
210
+ }
211
+ ure_main.change_caps_columns_quant();
212
+ jQuery('#granted_only').attr('checked', false);
213
+ },
214
+
215
+
216
+ hide_notice: function(el) {
217
+ if ( el.parentNode!==null) {
218
+ el.parentNode.removeChild(el);
219
+ }
220
+ },
221
+
222
+
223
+ show_notice: function(msg_text, msg_type) {
224
+
225
+ /* create notice div */
226
+ var div = document.createElement('div');
227
+ div.classList.add('notice', 'is-dismissible');
228
+ if (msg_type=='success') {
229
+ div.classList.add('notice-success'); // Green left border
230
+ } else if (msg_type=='info') {
231
+ div.classList.add('notice-info'); // Blue left border
232
+ } else if (msg_type=='error') {
233
+ div.classList.add('notice-error'); // Red left border
234
+ } else if (msg_type=='warning') {
235
+ div.classList.add('notice-warning'); // Yellow left border
236
+ }
237
+ /* create paragraph element to hold message */
238
+ var par = document.createElement('p');
239
+ /* Add message text */
240
+ par.appendChild(document.createTextNode(msg_text));
241
+ // Optionally add a link here
242
+
243
+ /* Add the whole message to notice div */
244
+ div.appendChild(par);
245
+
246
+ /* Create Dismiss icon */
247
+ var but = document.createElement('button');
248
+ but.setAttribute('type', 'button');
249
+ but.classList.add('notice-dismiss');
250
+ /* Add screen reader text to Dismiss icon */
251
+ var bSpan = document.createElement('span');
252
+ bSpan.classList.add('screen-reader-text');
253
+ bSpan.appendChild(document.createTextNode('Dismiss this notice'));
254
+ but.appendChild(bSpan);
255
+ /* Add Dismiss icon to notice */
256
+ div.appendChild(but);
257
+
258
+ /* Insert notice after the first h1 */
259
+ var h1 = document.getElementsByTagName('h1')[0];
260
+ h1.parentNode.insertBefore(div, h1.nextSibling);
261
+ /* Make the notice dismissable when the Dismiss icon is clicked */
262
+ but.addEventListener('click', function () {
263
+ div.parentNode.removeChild(div);
264
  });
265
+ setTimeout(this.hide_notice, 7000, div); // remove automatically after 7 sec.
266
+ },
267
+
268
+
269
+ show_granted_caps_only: function () {
270
+ var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
271
+ var hide_flag = jQuery('#granted_only').attr('checked');
272
+ jQuery('.ure-cap-div').each(function () {
273
+ var cap_div = jQuery(this);
274
+ if ( !cap_div.hasClass(ure_main.class_prefix + ure_main.selected_group ) ) { // apply to the currently selected group only
275
+ return;
276
+ }
277
+ var cap_id = cap_div.attr('id').substr( 12 );
278
+ var granted = jQuery('#'+ cap_id).attr('checked');
279
+ if ( granted ) {
280
+ return;
281
+ }
282
+ if ( hide_flag ) {
283
+ if ( !cap_div.hasClass('hidden') ) {
284
+ cap_div.addClass('hidden');
285
+ }
286
+ } else {
287
+ if ( cap_div.hasClass('ure-deprecated') && !show_deprecated ) {
288
+ return;
289
+ }
290
+ if ( cap_div.hasClass('hidden') ) {
291
+ cap_div.removeClass('hidden');
292
+ }
293
+ }
294
+ });
295
  },
296
 
 
 
 
 
 
 
 
297
 
298
+ sizes_update: function () {
299
+ var width = jQuery('#ure_caps_td').css('width');
300
+ jQuery('#ure_caps_list_container').css('width', width);
301
+ },
302
 
 
 
303
 
304
+ ui_button_text: function(caption) {
305
+ var wrapper = '<span class="ui-button-text">' + caption + '</span>';
306
 
307
+ return wrapper;
308
+ },
309
 
 
 
310
 
311
+ validate_columns: function (columns) {
312
+
313
+ if ( columns==1 || ure_main.selected_group==='all' ) {
314
+ return columns;
315
+ }
316
 
317
+ // Do not split list on columns in case it contains less then < 25 capabilities
318
+ for (var i=0; i<ure_main.caps_counter.length; i++) {
319
+ if ( ure_main.caps_counter[i].id===ure_main.selected_group ) {
320
+ if ( ure_main.caps_counter[i].total<=25 ) {
321
+ columns = 1;
322
+ }
323
+ break;
324
+ }
325
+ }
326
 
327
+ return columns;
328
+ },
329
+
 
 
 
 
 
330
 
331
+ init_caps_counter: function () {
332
+ ure_main.caps_counter = new Array();
333
+ jQuery('#ure_caps_groups_list li').each(function() {
334
+ var group_id = jQuery(this).attr('id').substr(15);
335
+ var group_counter = {'id': group_id, 'total': 0, 'granted':0};
336
+ ure_main.caps_counter.push( group_counter );
337
+ });
338
+
339
+ },
340
 
 
341
 
342
+ count_caps_in_groups: function () {
343
+ ure_main.init_caps_counter();
344
+
345
+ jQuery('.ure-cap-div').each(function () {
346
+ var cap_div = jQuery(this);
347
+ var capability = cap_div.attr('id').substr(12);
348
+ for (var i=0; i<ure_main.caps_counter.length; i++) {
349
+ if (cap_div.hasClass(ure_main.class_prefix + ure_main.caps_counter[i].id)) {
350
+ ure_main.caps_counter[i].total++;
351
+ if (jQuery('#'+ capability).is(':checked')) {
352
+ ure_main.caps_counter[i].granted++;
353
+ }
354
+ }
355
+ }
356
+ });
357
+
358
+ for (var i=0; i<ure_main.caps_counter.length; i++) {
359
+ var el = jQuery('#ure_caps_group_'+ ure_main.caps_counter[i].id);
360
+ var old_text = el.text();
361
+ var key_pos = old_text.indexOf('('); // exclude (0/0) text if it is in string already
362
+ if ( key_pos>0 ) {
363
+ old_text = old_text.substr( 0, key_pos - 1 );
364
+ }
365
+ var value = old_text +' ('+ ure_main.caps_counter[i].total +'/'+ ure_main.caps_counter[i].granted +')';
366
+
367
+ el.text(value);
368
  }
369
+
370
+ },
371
 
372
+
373
+ refresh_role_view: function ( response ) {
374
+ jQuery('#ure_task_status').hide();
375
+ if (response!==null && response.result=='error') {
376
+ ure_main.show_notice( response.message, 'error' );
377
+ return;
378
  }
 
379
 
380
+ // remove "Granted Only" filter is it was set before current role change
381
+ var granted_only = jQuery('#granted_only').prop('checked');
382
+ if (granted_only) {
383
+ jQuery('#granted_only').prop('checked', false);
384
+ ure_main.show_granted_caps_only();
385
+ }
386
 
387
+ if ( response.hasOwnProperty( 'role_id' ) && response.hasOwnProperty( 'role_name' ) ) {
388
+ ure_current_role = response.role_id;
389
+ ure_current_role_name = response.role_name;
390
+ }
391
+ // Select capabilities granted to a newly selected role and exclude others
392
+ jQuery('.ure-cap-cb').each(function () { // go through all capabilities checkboxes
393
+ if (this.id.length===0) {
394
+ return;
395
+ }
396
+ if ( response.hasOwnProperty( 'caps' ) ) {
397
+ jQuery(this).prop('checked', response.caps.hasOwnProperty(this.id) && response.caps[this.id]);
398
+ }
399
+ if ( ure_data.do_not_revoke_from_admin==1 ) {
400
+ var el = document.getElementById(this.id);
401
+ if ( 'administrator'===ure_current_role ) {
402
+ el.addEventListener( 'click', ure_turn_it_back );
403
+ } else {
404
+ el.removeEventListener( 'click', ure_turn_it_back );
405
+ }
406
+ }
407
+ });
408
+
409
+ // Recalculate granted capabilities for capabilities groups
410
+ ure_main.count_caps_in_groups();
411
+ ure_main.select_selectable_element( jQuery('#ure_caps_groups_list'), jQuery('#ure_caps_group_all') );
412
+
413
+ if (response.hasOwnProperty( 'options' ) ) {
414
+ // additional options section
415
+ jQuery('#additional_options').find(':checkbox').each(function() { // go through all additional options checkboxes
416
+ jQuery(this).prop('checked', response.options.hasOwnProperty(this.id));
417
+ });
418
+ }
419
+
420
+ },
421
+
422
+
423
+ role_change: function( role_id ) {
424
 
425
+ jQuery('#ure_task_status').show();
426
+ var data = {
427
+ 'action': 'ure_ajax',
428
+ 'sub_action':'get_role_caps',
429
+ 'role': role_id,
430
+ 'wp_nonce': ure_data.wp_nonce};
431
+ jQuery.post( ajaxurl, data, ure_main.refresh_role_view, 'json' );
432
 
433
+ },
434
+
435
+
436
+ show_add_role_dialog: function() {
437
 
438
+ jQuery('#ure_add_role_dialog').dialog({
439
  dialogClass: 'wp-dialog',
440
  modal: true,
441
  autoOpen: true,
446
  title: ure_data.add_new_role_title,
447
  'buttons': {
448
  'Add Role': function () {
449
+ var role_id = jQuery('#user_role_id').val();
450
+ if ( role_id=='' ) {
451
+ ure_main.show_notice( ure_data.role_name_required, 'warning' );
452
  return false;
453
  }
454
+ if ( !( /^[\w-]*$/.test( role_id ) ) ) {
455
+ ure_main.show_notice( ure_data.role_name_valid_chars, 'warning' );
456
  return false;
457
  }
458
+ if ( ( /^[0-9]*$/.test( role_id ) ) ) {
459
+ ure_main.show_notice( ure_data.numeric_role_name_prohibited, 'warning' );
460
  return false;
461
  }
462
+ var role_name = jQuery('#user_role_name').val();
463
+ var role_copy_from = jQuery('#user_role_copy_from').val();
464
+
465
+ jQuery('#ure_task_status').show();
466
+ jQuery.ajax( {
467
+ url: ajaxurl,
468
+ type: 'POST',
469
+ dataType: 'json',
470
+ async: true,
471
+ data: {
472
+ action: 'ure_ajax',
473
+ sub_action: 'add_role',
474
+ user_role_id: role_id,
475
+ user_role_name: role_name,
476
+ user_role_copy_from: role_copy_from,
477
+ network_admin: ure_data.network_admin,
478
+ wp_nonce: ure_data.wp_nonce
479
+ },
480
+ success: ure_main.add_role_success,
481
+ error: ure_main.ajax_error
482
+ } );
483
+
484
+ jQuery( this ).dialog('close');
485
  },
486
  CancelAddRole: function () {
487
+ jQuery(this).dialog('close');
488
  return false;
489
  }
490
  }
491
  });
492
+ jQuery( '.ui-dialog-buttonpane button:contains("Add Role")' ).attr( 'id', 'dialog-add-role-button' );
493
+ jQuery( '#dialog-add-role-button' ).html( this.ui_button_text( ure_data.add_role ) );
494
+ jQuery( '.ui-dialog-buttonpane button:contains("CancelAddRole")' ).attr( 'id', 'dialog-add-role-cancel-button' );
495
+ jQuery( '#dialog-add-role-cancel-button' ).html( this.ui_button_text( ure_data.cancel ) );
496
 
497
+ },
498
 
499
+ add_role_to_select: function( select_id, role_id, role_name ) {
500
+
501
+ jQuery( '#'+ select_id )
502
+ .append( jQuery( '<option>', {value : role_id} )
503
+ .text( role_name +' ('+ role_id +')' ) );
504
+ },
505
+
506
+
507
+ select_selectable_element: function (selectable_container, elements_to_select) {
508
+ // add unselecting class to all elements in the styleboard canvas except the ones to select
509
+ jQuery('.ui-selected', selectable_container).not(elements_to_select).removeClass('ui-selected').addClass('ui-unselecting');
510
+ // add ui-selecting class to the elements to select
511
+ jQuery(elements_to_select).not('.ui-selected').addClass('ui-selecting');
512
+ // trigger the mouse stop event (this will select all .ui-selecting elements, and deselect all .ui-unselecting elements)
513
+ selectable_container.data('ui-selectable')._mouseStop(null);
514
+ },
515
 
516
+
517
+ sort_roles_select: function ( role_id ) {
518
+ var select_list = jQuery('#user_role option');
519
+ select_list.sort( function( a, b ) {
520
+ var res = 0;
521
+ if (a.value<b.value) {
522
+ res = -1;
523
+ } else {
524
+ res = 1;
525
+ }
526
+ return res;
527
+ });
528
+ jQuery('#user_role').html( select_list );
529
+ jQuery('#user_role').val( role_id );
530
+ },
531
+
532
+ sort_roles_del_select: function ( ) {
533
+ var select_list = jQuery('#del_user_role option');
534
+ select_list.sort( function( a, b ) {
535
+ var res = 0;
536
+ if (a.value<b.value) {
537
+ res = -1;
538
+ } else {
539
+ res = 1;
540
+ }
541
+ return res;
542
+ });
543
+ jQuery('#del_user_role').html( select_list );
544
 
545
+ },
546
+
547
+ add_role_success: function( data ) {
548
+ jQuery('#ure_task_status').hide();
549
+ if ( data.result=='success' ) {
550
+ if ( data.role_id.length>0 ) {
551
+ // update list of roles available for selection as current role
552
+ ure_main.add_role_to_select( 'user_role', data.role_id, data.role_name );
553
+ ure_main.sort_roles_select( data.role_id );
554
+ ure_main.role_change( data.role_id );
555
+
556
+ // Update the list of roles available for deletion
557
+ ure_main.add_role_to_select( 'del_user_role', data.role_id, data.role_name );
558
+ ure_main.sort_roles_del_select();
559
+ if ( !jQuery( '#ure_delete_role' ).is( ':visible') ) {
560
+ jQuery( '#ure_delete_role' ).show();
561
+ }
562
+ }
563
+ ure_main.show_notice( data.message, 'success' );
564
+ } else {
565
+ ure_main.show_notice( data.message, 'error' );
566
+ }
567
+ },
568
+
569
+
570
+ show_add_capability_dialog: function() {
571
+
572
+ jQuery('#ure_add_capability_dialog').dialog({
573
+ dialogClass: 'wp-dialog',
574
+ modal: true,
575
+ autoOpen: true,
576
+ closeOnEscape: true,
577
+ width: 350,
578
+ height: 190,
579
+ resizable: false,
580
+ title: ure_data.add_capability,
581
+ 'buttons': {
582
+ 'Add Capability': function () {
583
+ var capability_id = jQuery( '#capability_id' ).val();
584
+ if ( capability_id == '' ) {
585
+ ure_main.show_notice( ure_data.capability_name_required, 'warning' );
586
+ return false;
587
+ }
588
+ if ( !( /^[\w-]*$/.test( capability_id ) ) ) {
589
+ ure_main.show_notice( ure_data.capability_name_valid_chars, 'warning' );
590
+ return false;
591
+ }
592
+ jQuery('#ure_task_status').show();
593
+ jQuery.ajax( {
594
+ url: ajaxurl,
595
+ type: 'POST',
596
+ dataType: 'json',
597
+ async: true,
598
+ data: {
599
+ action: 'ure_ajax',
600
+ sub_action: 'add_capability',
601
+ capability_id: capability_id,
602
+ user_role: jQuery('#user_role').val(),
603
+ network_admin: ure_data.network_admin,
604
+ wp_nonce: ure_data.wp_nonce
605
+ },
606
+ success: ure_main.add_capability_success,
607
+ error: ure_main.ajax_error
608
+ } );
609
+ jQuery( this ).dialog( 'close' );
610
+ },
611
+ CancelAddCapability: function () {
612
+ jQuery(this).dialog('close');
613
+ }
614
+ }
615
+ });
616
+ jQuery('.ui-dialog-buttonpane button:contains("Add Capability")').attr('id', 'dialog-add-capability-button');
617
+ jQuery('#dialog-add-capability-button').html(this.ui_button_text(ure_data.add_capability));
618
+ jQuery('.ui-dialog-buttonpane button:contains("CancelAddCapability")').attr('id', 'add-capability-dialog-cancel-button');
619
+ jQuery('#add-capability-dialog-cancel-button').html(this.ui_button_text(ure_data.cancel));
620
+
621
+ },
622
 
 
623
 
624
+ add_capability_success: function( data ) {
625
+ jQuery('#ure_task_status').hide();
626
+ if ( data.result=='success' ) {
627
+ if ( data.html.length>0 ) {
628
+ jQuery( '#ure_caps_list' ).html( data.html );
629
+ ure_main.refresh_role_view( data );
630
+ }
631
+ ure_main.show_notice( data.message, 'success' );
632
+ } else {
633
+ ure_main.show_notice( data.message, 'error' );
634
+ }
635
+ },
636
+
637
+
638
+ show_delete_capability_dialog: function () {
639
+ jQuery('#ure_delete_capability_dialog').dialog({
640
  dialogClass: 'wp-dialog',
641
  modal: true,
642
  autoOpen: true,
643
  closeOnEscape: true,
644
+ width: 350,
645
+ height: 400,
646
  resizable: false,
647
+ title: ure_data.delete_capability,
648
+ buttons: {
649
+ 'Delete Capability': function () {
650
+ if ( !confirm( ure_data.delete_capability + ' - ' + ure_data.delete_capability_warning ) ) {
651
+ return;
652
+ }
653
+ var values = {};
654
+ jQuery.each( jQuery('#ure_remove_caps_form').serializeArray(), function( i, field ) {
655
+ values[field.name] = field.value;
656
+ });
657
+ jQuery('#ure_task_status').show();
658
+ jQuery.ajax( {
659
+ url: ajaxurl,
660
+ type: 'POST',
661
+ dataType: 'json',
662
+ async: true,
663
+ data: {
664
+ action: 'ure_ajax',
665
+ sub_action: 'delete_capability',
666
+ values: values,
667
+ network_admin: ure_data.network_admin,
668
+ wp_nonce: ure_data.wp_nonce
669
+ },
670
+ success: ure_main.delete_capability_success,
671
+ error: ure_main.ajax_error
672
+ } );
673
+ jQuery(this).dialog('close');
674
  },
675
+ CancelDeleteCapability: function () {
676
+ jQuery(this).dialog('close');
 
677
  }
678
  }
679
  });
680
+ // translate buttons caption
681
+ jQuery('.ui-dialog-buttonpane button:contains("Delete Capability")').attr('id', 'dialog-delete-capability-button');
682
+ jQuery('#dialog-delete-capability-button').html(this.ui_button_text(ure_data.delete_capability));
683
+ jQuery('.ui-dialog-buttonpane button:contains("CancelDeleteCapability")').attr('id', 'delete-capability-dialog-cancel-button');
684
+ jQuery('#delete-capability-dialog-cancel-button').html(this.ui_button_text(ure_data.cancel));
685
+ jQuery('#ure_remove_caps_select_all').click(this.remove_caps_auto_select);
686
+ },
687
+
688
+
689
+ delete_capability_success: function( data ) {
690
+ jQuery('#ure_task_status').hide();
691
+ if ( data.result=='success' ) {
692
+ if ( data.deleted_caps.length>0 ) {
693
+ for(var i=0; i<data.deleted_caps.length; i++) {
694
+ jQuery('#ure_cap_div_'+ data.deleted_caps[i]).remove();
695
+ }
696
+ ure_main.count_caps_in_groups();
697
+ }
698
+ ure_main.show_notice( data.message, 'success' );
699
+ } else {
700
+ ure_main.show_notice( data.message, 'error' );
701
+ }
702
+ },
703
+
704
+
705
+ // Get from the server a list of capabilities we can delete and show dialog to select what to delete
706
+ get_caps_to_remove: {
707
+ url: ajaxurl,
708
+ type: 'POST',
709
+ dataType: 'json',
710
+ async: true,
711
+ data: {
712
+ action: 'ure_ajax',
713
+ sub_action: 'get_caps_to_remove',
714
+ current_role: jQuery('#user_role').val(),
715
+ network_admin: ure_data.network_admin,
716
+ wp_nonce: ure_data.wp_nonce
717
+ },
718
+ success: function ( response ) {
719
+ //var data = jQuery.parseJSON(response);
720
+ if ( typeof response.result !== 'undefined' ) {
721
+ if ( response.result === 'success' ) {
722
+ jQuery('#ure_delete_capability_dialog .ure-input').html( response.html );
723
+ ure_main.show_delete_capability_dialog();
724
+ } else if (data.result === 'failure') {
725
+ ure_main.show_notice( data.message, 'error' );
726
+ } else {
727
+ ure_main.show_notice( 'Wrong response: ' + response, 'error' )
728
+ }
729
+ } else {
730
+ ure_main.show_notice( 'Wrong response: ' + response, 'error' )
731
+ }
732
+ },
733
+ error: this.ajax_error
734
+ },
735
+
736
+ remove_caps_auto_select: function (event) {
737
+ if (event.shiftKey) {
738
+ jQuery('.ure-cb-column').each(function () { // reverse selection
739
+ jQuery(this).prop('checked', !jQuery(this).prop('checked'));
740
+ });
741
+ } else { // switch On/Off all checkboxes
742
+ jQuery('.ure-cb-column').prop('checked', jQuery('#ure_remove_caps_select_all').prop('checked'));
743
 
744
+ }
745
+ },
746
+
747
+
748
+ show_delete_role_dialog: function () {
749
+ jQuery('#ure_delete_role_dialog').dialog({
750
  dialogClass: 'wp-dialog',
751
  modal: true,
752
  autoOpen: true,
757
  title: ure_data.delete_role,
758
  buttons: {
759
  'Delete Role': function () {
760
+ var user_role_id = jQuery('#del_user_role').val();
761
  var question = '';
762
  if (user_role_id!=-1) {
763
  question = ure_data.delete_role +' "'+ user_role_id +'"';
764
  } else {
765
+ question = jQuery('#del_user_role').find('option:selected').text();
766
  }
767
  question += '?';
768
+ if ( !confirm( question ) ) {
769
  return false;
770
  }
771
+
772
+ jQuery('#ure_task_status').show();
773
+ jQuery.ajax( {
774
+ url: ajaxurl,
775
+ type: 'POST',
776
+ dataType: 'json',
777
+ async: true,
778
+ data: {
779
+ action: 'ure_ajax',
780
+ sub_action: 'delete_role',
781
+ user_role_id: user_role_id,
782
+ network_admin: ure_data.network_admin,
783
+ wp_nonce: ure_data.wp_nonce
784
+ },
785
+ success: ure_main.delete_role_success,
786
+ error: ure_main.ajax_error
787
+ } );
788
+
789
+ jQuery(this).dialog('close');
790
  },
791
  CancelDeleteRole: function () {
792
+ jQuery(this).dialog('close');
793
  }
794
  }
795
  });
796
  // translate buttons caption
797
+ jQuery('.ui-dialog-buttonpane button:contains("Delete Role")').attr('id', 'dialog-delete-role-button');
798
+ jQuery('#dialog-delete-role-button').html( ure_main.ui_button_text( ure_data.delete_role ) );
799
+ jQuery('.ui-dialog-buttonpane button:contains("CancelDeleteRole")').attr('id', 'dialog-delete-role-cancel-button');
800
+ jQuery('#dialog-delete-role-cancel-button').html( ure_main.ui_button_text( ure_data.cancel ) );
801
+ },
802
 
803
+
804
+ delete_role_success: function( data ) {
805
+ jQuery('#ure_task_status').hide();
806
+ if ( data.result=='success' ) {
807
+ if ( data.deleted_roles.length>0 ) {
808
+ force_current_role_change = false;
809
+ for( var i=0; i<data.deleted_roles.length; i++ ) {
810
+ jQuery('#del_user_role option[value="'+ data.deleted_roles[i] +'"]').remove();
811
+ jQuery('#user_role option[value="'+ data.deleted_roles[i] +'"]').remove();
812
+ if ( data.deleted_roles[i]==ure_current_role ) {
813
+ force_current_role_change = true;
814
+ }
815
+ }
816
+ var del_role_list = jQuery('#del_user_role option');
817
+ if ( del_role_list.length==1 ) {
818
+ jQuery( '#ure_delete_role' ).hide();
819
+ }
820
+ if ( force_current_role_change ) {
821
+ var select_role_list = jQuery('#user_role option');
822
+ var el = select_role_list[select_role_list.length-1];
823
+ var role_id = el.value;
824
+ jQuery('#user_role').val( role_id );
825
+ ure_main.role_change( role_id );
826
+ }
827
+ }
828
+ ure_main.show_notice( data.message, 'success' );
829
+ } else {
830
+ ure_main.show_notice( data.message, 'error' );
831
+ }
832
+ },
833
+
834
+
835
+ show_rename_role_dialog: function () {
836
 
837
+ jQuery('#ure_rename_role_dialog').dialog({
 
 
 
 
 
 
 
 
 
838
  dialogClass: 'wp-dialog',
839
  modal: true,
840
  autoOpen: true,
841
  closeOnEscape: true,
842
+ width: 450,
843
+ height: 230,
844
  resizable: false,
845
+ title: ure_data.rename_role_title,
846
  'buttons': {
847
+ 'Rename Role': function () {
848
+ var role_id = jQuery('#ren_user_role_id').val();
849
+ var role_name = jQuery('#ren_user_role_name').val();
850
+ jQuery('#ure_task_status').show();
851
+ jQuery.ajax( {
852
+ url: ajaxurl,
853
+ type: 'POST',
854
+ dataType: 'json',
855
+ async: true,
856
+ data: {
857
+ action: 'ure_ajax',
858
+ sub_action: 'rename_role',
859
+ user_role_id: role_id,
860
+ user_role_name: role_name,
861
+ network_admin: ure_data.network_admin,
862
+ wp_nonce: ure_data.wp_nonce
863
+ },
864
+ success: ure_main.rename_role_success,
865
+ error: ure_main.ajax_error
866
+ } );
867
+ jQuery(this).dialog('close');
868
+ /*
869
+ jQuery.ure_postGo(ure_data.page_url,
870
+ {action: 'rename-role', user_role_id: role_id, user_role_name: role_name, ure_nonce: ure_data.wp_nonce}
871
+ );
872
+ */
873
  },
874
+ CancelRenameRole: function () {
875
+ jQuery(this).dialog('close');
876
+ return false;
877
  }
878
  }
879
  });
880
+ jQuery('.ui-dialog-buttonpane button:contains("Rename Role")').attr('id', 'dialog-rename-role-button');
881
+ jQuery('#dialog-rename-role-button').html( ure_main.ui_button_text( ure_data.rename_role ) );
882
+ jQuery('.ui-dialog-buttonpane button:contains("CancelRenameRole")').attr('id', 'rename-role-dialog-cancel-button');
883
+ jQuery('#rename-role-dialog-cancel-button').html( ure_main.ui_button_text( ure_data.cancel ) );
884
+ jQuery('#ren_user_role_id').val( ure_current_role );
885
+ jQuery('#ren_user_role_name').val( ure_current_role_name );
886
+
887
+ },
888
+
889
+
890
+ rename_role_success: function( data ) {
891
 
892
+ jQuery('#ure_task_status').hide();
893
+ if ( data.result=='success' ) {
894
+ if ( data.role_id.length>0 ) {
895
+ jQuery( '#user_role option[value="'+ data.role_id+'"]' ).text( data.role_name +' ('+ data.role_id +')' );
896
+ ure_current_role_name = data.role_name;
897
+ }
898
+ ure_main.show_notice( data.message, 'success' );
899
+ } else {
900
+ ure_main.show_notice( data.message, 'error' );
901
+ }
902
+ }
903
+
904
+ }; // end of ure_main declaration
905
+ //-------------------------------
906
 
907
 
 
 
 
 
 
 
 
908
 
909
+ function ure_ui_button_text(caption) {
910
+ var wrapper = '<span class="ui-button-text">' + caption + '</span>';
911
+
912
+ return wrapper;
913
+ }
914
+
915
+
916
+ jQuery(function ($) {
917
+
918
+ $('#ure_update_role').button({
919
+ label: ure_data.update
920
+ }).click(function () {
921
+ if (ure_data.confirm_role_update == 1) {
922
  event.preventDefault();
923
+ ure_confirm(ure_data.confirm_submit, ure_form_submit);
924
+ }
925
+ });
926
+
927
+
928
+ function ure_form_submit() {
929
+ $('#ure_form').submit();
930
+ }
931
 
932
 
933
  function ure_show_default_role_dialog() {
1008
  // end of jQuery(function() ...
1009
 
1010
 
 
 
 
 
 
 
 
 
 
 
 
 
1011
  // turn on checkbox back if clicked to turn off - for 'administrator' role only!
1012
  function ure_turn_it_back( event ) {
1013
 
1019
  // end of ure_turn_it_back()
1020
 
1021
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1022
  function ure_turn_caps_readable(user_id) {
1023
  var ure_obj = 'user';
1024
  if (user_id === 0) {
1043
  // ure_turn_deprecated_caps()
1044
 
1045
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1046
  function ure_filter_capabilities(cap_id) {
1047
  var div_list = jQuery('.ure-cap-div');
1048
  for (var i = 0; i < div_list.length; i++) {
1067
  // end of ure_hide_this_banner()
1068
 
1069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1070
  jQuery(window).resize(function () {
1071
+ ure_main.sizes_update();
1072
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/user-role-editor.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: User Role Editor 4.51\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2019-05-21 11:18+0700\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Vladimir Garagulya <vladimir@shinephp.com>\n"
9
  "Language-Team: https://www.role-editor.com <support@role-editor.com>\n"
@@ -22,9 +22,9 @@ msgid "Custom Post Types"
22
  msgstr ""
23
 
24
  #: ../includes/classes/capabilities-groups-manager.php:75
25
- #: ../includes/classes/editor.php:1243
26
- #: ../includes/classes/user-role-editor.php:553
27
- #: ../includes/classes/user-role-editor.php:584
28
  msgid "User Role Editor"
29
  msgstr ""
30
 
@@ -42,7 +42,7 @@ msgid "All"
42
  msgstr ""
43
 
44
  #: ../includes/classes/capabilities-groups-manager.php:112
45
- #: ../includes/classes/user-role-editor.php:525
46
  #: ../includes/settings-template.php:20
47
  msgid "General"
48
  msgstr ""
@@ -68,7 +68,7 @@ msgid "Users"
68
  msgstr ""
69
 
70
  #: ../includes/classes/capabilities-groups-manager.php:121
71
- #: ../includes/classes/user-role-editor.php:543
72
  #: ../includes/settings-template.php:36
73
  msgid "Multisite"
74
  msgstr ""
@@ -93,35 +93,39 @@ msgstr ""
93
  msgid "Error: this word is used by WordPress as a role ID"
94
  msgstr ""
95
 
96
- #: ../includes/classes/capability.php:79 ../includes/classes/capability.php:189
97
- #: ../includes/classes/editor.php:749 ../includes/classes/editor.php:817
98
- #: ../includes/classes/editor.php:871 ../includes/classes/editor.php:959
99
- #: ../includes/classes/editor.php:1013 ../includes/classes/editor.php:1051
100
- #: ../includes/classes/user-role-editor.php:637
101
  msgid "Insufficient permissions to work with User Role Editor"
102
  msgstr ""
103
 
104
- #: ../includes/classes/capability.php:100
 
 
 
 
105
  #, php-format
106
  msgid "Capability %s was added successfully"
107
  msgstr ""
108
 
109
- #: ../includes/classes/capability.php:102
110
  #, php-format
111
  msgid "Capability %s exists already"
112
  msgstr ""
113
 
114
- #: ../includes/classes/capability.php:196
115
- #: ../includes/classes/capability.php:201
116
  msgid "There are no capabilities available for deletion!"
117
  msgstr ""
118
 
119
- #: ../includes/classes/capability.php:207
120
  #, php-format
121
  msgid "Capability %s was removed successfully"
122
  msgstr ""
123
 
124
- #: ../includes/classes/capability.php:211
125
  msgid "capabilities were removed successfully"
126
  msgstr ""
127
 
@@ -177,354 +181,354 @@ msgid ""
177
  "characters to it."
178
  msgstr ""
179
 
180
- #: ../includes/classes/editor.php:828
181
  #, php-format
182
  msgid "Role %s exists already"
183
  msgstr ""
184
 
185
- #: ../includes/classes/editor.php:849
186
  msgid "Error is encountered during new role create operation"
187
  msgstr ""
188
 
189
- #: ../includes/classes/editor.php:851
190
  #, php-format
191
  msgid "Role %s is created successfully"
192
  msgstr ""
193
 
194
- #: ../includes/classes/editor.php:881
195
  msgid "Error: Empty role display name is not allowed."
196
  msgstr ""
197
 
198
- #: ../includes/classes/editor.php:888
199
  #, php-format
200
  msgid "Role %s does not exists"
201
  msgstr ""
202
 
203
- #: ../includes/classes/editor.php:900
204
  #, php-format
205
  msgid "Role %s is renamed to %s successfully"
206
  msgstr ""
207
 
208
- #: ../includes/classes/editor.php:964
209
- msgid "Empty or not valid list of roles for deletion"
210
- msgstr ""
211
-
212
- #: ../includes/classes/editor.php:973
213
  msgid "Role does not exist"
214
  msgstr ""
215
 
216
- #: ../includes/classes/editor.php:977
217
  msgid "You can not delete role"
218
  msgstr ""
219
 
220
- #: ../includes/classes/editor.php:1025
 
 
 
 
 
 
 
 
221
  msgid "Unused roles are deleted successfully"
222
  msgstr ""
223
 
224
- #: ../includes/classes/editor.php:1027
225
  #, php-format
226
  msgid "Role %s is deleted successfully"
227
  msgstr ""
228
 
229
- #: ../includes/classes/editor.php:1030
230
- msgid "Error encountered during role delete operation"
231
- msgstr ""
232
-
233
- #: ../includes/classes/editor.php:1057
234
  msgid ""
235
  "This method is only for the single site of WordPress multisite installation."
236
  msgstr ""
237
 
238
- #: ../includes/classes/editor.php:1061
239
  msgid "Wrong request. Default role can not be empty"
240
  msgstr ""
241
 
242
- #: ../includes/classes/editor.php:1073
243
  #, php-format
244
  msgid "Default role for new users is set to %s successfully"
245
  msgstr ""
246
 
247
- #: ../includes/classes/editor.php:1075
248
  msgid "Error encountered during default role change operation"
249
  msgstr ""
250
 
251
- #: ../includes/classes/editor.php:1078
252
  msgid "Can not set Administrator role as a default one"
253
  msgstr ""
254
 
255
- #: ../includes/classes/editor.php:1080
256
  msgid "This role does not exist - "
257
  msgstr ""
258
 
259
- #: ../includes/classes/editor.php:1151
260
  msgid "User Roles are restored to WordPress default values. "
261
  msgstr ""
262
 
263
- #: ../includes/classes/editor.php:1282
264
  msgid "Error: wrong request"
265
  msgstr ""
266
 
267
- #: ../includes/classes/editor.php:1311
268
  msgid "Editor"
269
  msgstr ""
270
 
271
- #: ../includes/classes/editor.php:1312
272
  msgid "Author"
273
  msgstr ""
274
 
275
- #: ../includes/classes/editor.php:1313
276
  msgid "Contributor"
277
  msgstr ""
278
 
279
- #: ../includes/classes/editor.php:1314
280
  msgid "Subscriber"
281
  msgstr ""
282
 
283
- #: ../includes/classes/editor.php:1316
284
  msgid "Switch themes"
285
  msgstr ""
286
 
287
- #: ../includes/classes/editor.php:1317
288
  msgid "Edit themes"
289
  msgstr ""
290
 
291
- #: ../includes/classes/editor.php:1318
292
  msgid "Activate plugins"
293
  msgstr ""
294
 
295
- #: ../includes/classes/editor.php:1319
296
  msgid "Edit plugins"
297
  msgstr ""
298
 
299
- #: ../includes/classes/editor.php:1320
300
  msgid "Edit users"
301
  msgstr ""
302
 
303
- #: ../includes/classes/editor.php:1321
304
  msgid "Edit files"
305
  msgstr ""
306
 
307
- #: ../includes/classes/editor.php:1322
308
  msgid "Manage options"
309
  msgstr ""
310
 
311
- #: ../includes/classes/editor.php:1323
312
  msgid "Moderate comments"
313
  msgstr ""
314
 
315
- #: ../includes/classes/editor.php:1324
316
  msgid "Manage categories"
317
  msgstr ""
318
 
319
- #: ../includes/classes/editor.php:1325
320
  msgid "Manage links"
321
  msgstr ""
322
 
323
- #: ../includes/classes/editor.php:1326
324
  msgid "Upload files"
325
  msgstr ""
326
 
327
- #: ../includes/classes/editor.php:1327
328
  msgid "Import"
329
  msgstr ""
330
 
331
- #: ../includes/classes/editor.php:1328
332
  msgid "Unfiltered html"
333
  msgstr ""
334
 
335
- #: ../includes/classes/editor.php:1329
336
  msgid "Edit posts"
337
  msgstr ""
338
 
339
- #: ../includes/classes/editor.php:1330
340
  msgid "Edit others posts"
341
  msgstr ""
342
 
343
- #: ../includes/classes/editor.php:1331
344
  msgid "Edit published posts"
345
  msgstr ""
346
 
347
- #: ../includes/classes/editor.php:1332
348
  msgid "Publish posts"
349
  msgstr ""
350
 
351
- #: ../includes/classes/editor.php:1333
352
  msgid "Edit pages"
353
  msgstr ""
354
 
355
- #: ../includes/classes/editor.php:1334
356
  msgid "Read"
357
  msgstr ""
358
 
359
- #: ../includes/classes/editor.php:1335
360
  msgid "Level 10"
361
  msgstr ""
362
 
363
- #: ../includes/classes/editor.php:1336
364
  msgid "Level 9"
365
  msgstr ""
366
 
367
- #: ../includes/classes/editor.php:1337
368
  msgid "Level 8"
369
  msgstr ""
370
 
371
- #: ../includes/classes/editor.php:1338
372
  msgid "Level 7"
373
  msgstr ""
374
 
375
- #: ../includes/classes/editor.php:1339
376
  msgid "Level 6"
377
  msgstr ""
378
 
379
- #: ../includes/classes/editor.php:1340
380
  msgid "Level 5"
381
  msgstr ""
382
 
383
- #: ../includes/classes/editor.php:1341
384
  msgid "Level 4"
385
  msgstr ""
386
 
387
- #: ../includes/classes/editor.php:1342
388
  msgid "Level 3"
389
  msgstr ""
390
 
391
- #: ../includes/classes/editor.php:1343
392
  msgid "Level 2"
393
  msgstr ""
394
 
395
- #: ../includes/classes/editor.php:1344
396
  msgid "Level 1"
397
  msgstr ""
398
 
399
- #: ../includes/classes/editor.php:1345
400
  msgid "Level 0"
401
  msgstr ""
402
 
403
- #: ../includes/classes/editor.php:1346
404
  msgid "Edit others pages"
405
  msgstr ""
406
 
407
- #: ../includes/classes/editor.php:1347
408
  msgid "Edit published pages"
409
  msgstr ""
410
 
411
- #: ../includes/classes/editor.php:1348
412
  msgid "Publish pages"
413
  msgstr ""
414
 
415
- #: ../includes/classes/editor.php:1349
416
  msgid "Delete pages"
417
  msgstr ""
418
 
419
- #: ../includes/classes/editor.php:1350
420
  msgid "Delete others pages"
421
  msgstr ""
422
 
423
- #: ../includes/classes/editor.php:1351
424
  msgid "Delete published pages"
425
  msgstr ""
426
 
427
- #: ../includes/classes/editor.php:1352
428
  msgid "Delete posts"
429
  msgstr ""
430
 
431
- #: ../includes/classes/editor.php:1353
432
  msgid "Delete others posts"
433
  msgstr ""
434
 
435
- #: ../includes/classes/editor.php:1354
436
  msgid "Delete published posts"
437
  msgstr ""
438
 
439
- #: ../includes/classes/editor.php:1355
440
  msgid "Delete private posts"
441
  msgstr ""
442
 
443
- #: ../includes/classes/editor.php:1356
444
  msgid "Edit private posts"
445
  msgstr ""
446
 
447
- #: ../includes/classes/editor.php:1357
448
  msgid "Read private posts"
449
  msgstr ""
450
 
451
- #: ../includes/classes/editor.php:1358
452
  msgid "Delete private pages"
453
  msgstr ""
454
 
455
- #: ../includes/classes/editor.php:1359
456
  msgid "Edit private pages"
457
  msgstr ""
458
 
459
- #: ../includes/classes/editor.php:1360
460
  msgid "Read private pages"
461
  msgstr ""
462
 
463
- #: ../includes/classes/editor.php:1361
464
  msgid "Delete users"
465
  msgstr ""
466
 
467
- #: ../includes/classes/editor.php:1362
468
  msgid "Create users"
469
  msgstr ""
470
 
471
- #: ../includes/classes/editor.php:1363
472
  msgid "Unfiltered upload"
473
  msgstr ""
474
 
475
- #: ../includes/classes/editor.php:1364
476
  msgid "Edit dashboard"
477
  msgstr ""
478
 
479
- #: ../includes/classes/editor.php:1365
480
  msgid "Update plugins"
481
  msgstr ""
482
 
483
- #: ../includes/classes/editor.php:1366
484
  msgid "Delete plugins"
485
  msgstr ""
486
 
487
- #: ../includes/classes/editor.php:1367
488
  msgid "Install plugins"
489
  msgstr ""
490
 
491
- #: ../includes/classes/editor.php:1368
492
  msgid "Update themes"
493
  msgstr ""
494
 
495
- #: ../includes/classes/editor.php:1369
496
  msgid "Install themes"
497
  msgstr ""
498
 
499
- #: ../includes/classes/editor.php:1370
500
  msgid "Update core"
501
  msgstr ""
502
 
503
- #: ../includes/classes/editor.php:1371
504
  msgid "List users"
505
  msgstr ""
506
 
507
- #: ../includes/classes/editor.php:1372
508
  msgid "Remove users"
509
  msgstr ""
510
 
511
- #: ../includes/classes/editor.php:1373
512
  msgid "Add users"
513
  msgstr ""
514
 
515
- #: ../includes/classes/editor.php:1374
516
  msgid "Promote users"
517
  msgstr ""
518
 
519
- #: ../includes/classes/editor.php:1375
520
  msgid "Edit theme options"
521
  msgstr ""
522
 
523
- #: ../includes/classes/editor.php:1376
524
  msgid "Delete themes"
525
  msgstr ""
526
 
527
- #: ../includes/classes/editor.php:1377
528
  msgid "Export"
529
  msgstr ""
530
 
@@ -569,61 +573,61 @@ msgstr ""
569
  msgid "Other Roles: "
570
  msgstr ""
571
 
572
- #: ../includes/classes/grant-roles.php:440
573
  msgid "Grant Roles"
574
  msgstr ""
575
 
576
- #: ../includes/classes/grant-roles.php:442
577
- #: ../includes/classes/grant-roles.php:444
578
  msgid "Add role&hellip;"
579
  msgstr ""
580
 
581
- #: ../includes/classes/grant-roles.php:447
582
  msgid "Add"
583
  msgstr ""
584
 
585
- #: ../includes/classes/grant-roles.php:449
586
- #: ../includes/classes/grant-roles.php:451
587
  msgid "Revoke role&hellip;"
588
  msgstr ""
589
 
590
- #: ../includes/classes/grant-roles.php:454
591
  msgid "Revoke"
592
  msgstr ""
593
 
594
- #: ../includes/classes/grant-roles.php:486
595
  msgid "Grant roles to selected users"
596
  msgstr ""
597
 
598
- #: ../includes/classes/grant-roles.php:487
599
  msgid "Select users to which you wish to grant roles!"
600
  msgstr ""
601
 
602
- #: ../includes/classes/grant-roles.php:488
603
  msgid "Select role(s) which you wish to grant!"
604
  msgstr ""
605
 
606
- #: ../includes/classes/lib.php:384
607
  msgid "Version:"
608
  msgstr ""
609
 
610
- #: ../includes/classes/lib.php:385
611
  msgid "Author's website"
612
  msgstr ""
613
 
614
- #: ../includes/classes/lib.php:386
615
  msgid "Plugin webpage"
616
  msgstr ""
617
 
618
- #: ../includes/classes/lib.php:387
619
  msgid "Plugin download"
620
  msgstr ""
621
 
622
- #: ../includes/classes/lib.php:388 ../includes/classes/user-role-editor.php:502
623
  msgid "Changelog"
624
  msgstr ""
625
 
626
- #: ../includes/classes/lib.php:389
627
  msgid "FAQ"
628
  msgstr ""
629
 
@@ -635,52 +639,52 @@ msgstr ""
635
  msgid "Additional Options"
636
  msgstr ""
637
 
638
- #: ../includes/classes/role-view.php:74
639
  msgid "None"
640
  msgstr ""
641
 
642
- #: ../includes/classes/role-view.php:109
643
  msgid "Delete All Unused Roles"
644
  msgstr ""
645
 
646
- #: ../includes/classes/role-view.php:209 ../includes/classes/role-view.php:220
647
  msgid "Role name (ID): "
648
  msgstr ""
649
 
650
- #: ../includes/classes/role-view.php:211 ../includes/classes/role-view.php:222
651
  msgid "Display Role Name: "
652
  msgstr ""
653
 
654
- #: ../includes/classes/role-view.php:213
655
  msgid "Make copy of: "
656
  msgstr ""
657
 
658
- #: ../includes/classes/role-view.php:229
659
  msgid "Select Role:"
660
  msgstr ""
661
 
662
- #: ../includes/classes/role-view.php:254
663
  msgid "Capability name (ID): "
664
  msgstr ""
665
 
666
- #: ../includes/classes/role-view.php:366 ../includes/classes/user-view.php:154
667
  msgid "Show capabilities in human readable form"
668
  msgstr ""
669
 
670
- #: ../includes/classes/role-view.php:376 ../includes/classes/screen-help.php:21
671
  #: ../includes/classes/user-view.php:164 ../includes/settings-template.php:78
672
  msgid "Show deprecated capabilities"
673
  msgstr ""
674
 
675
- #: ../includes/classes/role-view.php:380
676
  msgid "If checked, then apply action to ALL sites of this Network"
677
  msgstr ""
678
 
679
- #: ../includes/classes/role-view.php:393 ../includes/classes/tools.php:30
680
  msgid "Apply to All Sites"
681
  msgstr ""
682
 
683
- #: ../includes/classes/role-view.php:410
684
  msgid "Select Role and change its capabilities:"
685
  msgstr ""
686
 
@@ -815,7 +819,7 @@ msgid "Reset Roles to its original state"
815
  msgstr ""
816
 
817
  #: ../includes/classes/tools.php:36
818
- #: ../includes/classes/user-role-editor.php:774
819
  msgid "Reset"
820
  msgstr ""
821
 
@@ -824,7 +828,7 @@ msgid "Tools: Reset: User Roles were initialized"
824
  msgstr ""
825
 
826
  #: ../includes/classes/user-other-roles.php:85
827
- #: ../includes/classes/user-other-roles.php:220
828
  msgid "Other Roles"
829
  msgstr ""
830
 
@@ -832,182 +836,182 @@ msgstr ""
832
  msgid "Select additional roles for this user"
833
  msgstr ""
834
 
835
- #: ../includes/classes/user-other-roles.php:182
836
  #, php-format
837
  msgid "Denied: %s"
838
  msgstr ""
839
 
840
- #: ../includes/classes/user-other-roles.php:199
841
- #: ../includes/classes/user-role-editor.php:378
842
  msgid "Capabilities"
843
  msgstr ""
844
 
845
- #: ../includes/classes/user-other-roles.php:206
846
  msgid "Edit"
847
  msgstr ""
848
 
849
- #: ../includes/classes/user-other-roles.php:264
850
  msgid "Additional Capabilities"
851
  msgstr ""
852
 
853
- #: ../includes/classes/user-role-editor.php:275
854
  msgid "Change role for users without role"
855
  msgstr ""
856
 
857
- #: ../includes/classes/user-role-editor.php:276
858
  msgid "To:"
859
  msgstr ""
860
 
861
- #: ../includes/classes/user-role-editor.php:277
862
  msgid "No rights"
863
  msgstr ""
864
 
865
- #: ../includes/classes/user-role-editor.php:278
866
  msgid "Provide new role"
867
  msgstr ""
868
 
869
- #: ../includes/classes/user-role-editor.php:350
870
- #: ../includes/classes/user-role-editor.php:352
871
  msgid "You do not have permission to edit this user."
872
  msgstr ""
873
 
874
- #: ../includes/classes/user-role-editor.php:476
875
  #: ../includes/classes/user-role-editor.php:489
 
876
  msgid "Settings"
877
  msgstr ""
878
 
879
- #: ../includes/classes/user-role-editor.php:531
880
  #: ../includes/settings-template.php:26
881
  msgid "Additional Modules"
882
  msgstr ""
883
 
884
- #: ../includes/classes/user-role-editor.php:537
885
  #: ../includes/settings-template.php:31
886
  msgid "Default Roles"
887
  msgstr ""
888
 
889
- #: ../includes/classes/user-role-editor.php:604
890
  msgid ""
891
  "You do not have sufficient permissions to manage options for User Role "
892
  "Editor."
893
  msgstr ""
894
 
895
- #: ../includes/classes/user-role-editor.php:724
896
- #: ../includes/classes/user-role-editor.php:771
897
  msgid "Confirm"
898
  msgstr ""
899
 
900
- #: ../includes/classes/user-role-editor.php:725
901
- #: ../includes/classes/user-role-editor.php:772
902
  msgid "Yes"
903
  msgstr ""
904
 
905
- #: ../includes/classes/user-role-editor.php:726
906
- #: ../includes/classes/user-role-editor.php:773
907
  msgid "No"
908
  msgstr ""
909
 
910
- #: ../includes/classes/user-role-editor.php:727
911
  msgid "Update"
912
  msgstr ""
913
 
914
- #: ../includes/classes/user-role-editor.php:728
915
  msgid "Please confirm permissions update"
916
  msgstr ""
917
 
918
- #: ../includes/classes/user-role-editor.php:729
919
  msgid "Add New Role"
920
  msgstr ""
921
 
922
- #: ../includes/classes/user-role-editor.php:730
923
- #: ../includes/classes/user-role-editor.php:735
924
  msgid "Rename Role"
925
  msgstr ""
926
 
927
- #: ../includes/classes/user-role-editor.php:731
928
  msgid " Role name (ID) can not be empty!"
929
  msgstr ""
930
 
931
- #: ../includes/classes/user-role-editor.php:732
932
  msgid ""
933
  " Role name (ID) must contain latin characters, digits, hyphens or underscore "
934
  "only!"
935
  msgstr ""
936
 
937
- #: ../includes/classes/user-role-editor.php:733
938
  msgid ""
939
  " WordPress does not support numeric Role name (ID). Add latin characters to "
940
  "it."
941
  msgstr ""
942
 
943
- #: ../includes/classes/user-role-editor.php:734
944
  msgid "Add Role"
945
  msgstr ""
946
 
947
- #: ../includes/classes/user-role-editor.php:736
948
  msgid "Delete Role"
949
  msgstr ""
950
 
951
- #: ../includes/classes/user-role-editor.php:737
952
  msgid "Cancel"
953
  msgstr ""
954
 
955
- #: ../includes/classes/user-role-editor.php:738
956
  msgid "Add Capability"
957
  msgstr ""
958
 
959
- #: ../includes/classes/user-role-editor.php:739
960
- #: ../includes/classes/user-role-editor.php:743
961
  msgid "Delete Capability"
962
  msgstr ""
963
 
964
- #: ../includes/classes/user-role-editor.php:740
965
- #: ../includes/classes/user-role-editor.php:780
966
  msgid "Continue?"
967
  msgstr ""
968
 
969
- #: ../includes/classes/user-role-editor.php:741
970
  msgid "Default Role"
971
  msgstr ""
972
 
973
- #: ../includes/classes/user-role-editor.php:742
974
  msgid "Set New Default Role"
975
  msgstr ""
976
 
977
- #: ../includes/classes/user-role-editor.php:744
978
  msgid ""
979
  "Warning! Be careful - removing critical capability could crash some plugin "
980
  "or other custom code"
981
  msgstr ""
982
 
983
- #: ../includes/classes/user-role-editor.php:745
984
  msgid " Capability name (ID) can not be empty!"
985
  msgstr ""
986
 
987
- #: ../includes/classes/user-role-editor.php:746
988
  msgid ""
989
  " Capability name (ID) must contain latin characters, digits, hyphens or "
990
  "underscore only!"
991
  msgstr ""
992
 
993
- #: ../includes/classes/user-role-editor.php:775
994
  msgid "DANGER!"
995
  msgstr ""
996
 
997
- #: ../includes/classes/user-role-editor.php:776
998
  msgid ""
999
  " Resetting will restore default user roles and capabilities from WordPress "
1000
  "core."
1001
  msgstr ""
1002
 
1003
- #: ../includes/classes/user-role-editor.php:777
1004
  msgid ""
1005
  "If any plugins (such as WooCommerce, S2Member and many others) have changed "
1006
  "user roles and capabilities during installation, all those changes will be "
1007
  "LOST!"
1008
  msgstr ""
1009
 
1010
- #: ../includes/classes/user-role-editor.php:778
1011
  msgid ""
1012
  "For more information on how to undo undesired changes and restore plugin "
1013
  "capabilities go to"
@@ -1037,31 +1041,31 @@ msgstr ""
1037
  msgid "Other Roles:"
1038
  msgstr ""
1039
 
1040
- #: ../includes/classes/view.php:272
1041
  msgid "Working..."
1042
  msgstr ""
1043
 
1044
- #: ../includes/classes/view.php:303
1045
  msgid "Group"
1046
  msgstr ""
1047
 
1048
- #: ../includes/classes/view.php:303
1049
  msgid "Total"
1050
  msgstr ""
1051
 
1052
- #: ../includes/classes/view.php:303
1053
  msgid "Granted"
1054
  msgstr ""
1055
 
1056
- #: ../includes/classes/view.php:316
1057
  msgid "Quick filter:"
1058
  msgstr ""
1059
 
1060
- #: ../includes/classes/view.php:319
1061
  msgid "Granted Only"
1062
  msgstr ""
1063
 
1064
- #: ../includes/classes/view.php:322
1065
  msgid "Columns:"
1066
  msgstr ""
1067
 
3
  msgstr ""
4
  "Project-Id-Version: User Role Editor 4.51\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2020-02-01 11:23+0700\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Vladimir Garagulya <vladimir@shinephp.com>\n"
9
  "Language-Team: https://www.role-editor.com <support@role-editor.com>\n"
22
  msgstr ""
23
 
24
  #: ../includes/classes/capabilities-groups-manager.php:75
25
+ #: ../includes/classes/editor.php:1237
26
+ #: ../includes/classes/user-role-editor.php:566
27
+ #: ../includes/classes/user-role-editor.php:597
28
  msgid "User Role Editor"
29
  msgstr ""
30
 
42
  msgstr ""
43
 
44
  #: ../includes/classes/capabilities-groups-manager.php:112
45
+ #: ../includes/classes/user-role-editor.php:538
46
  #: ../includes/settings-template.php:20
47
  msgid "General"
48
  msgstr ""
68
  msgstr ""
69
 
70
  #: ../includes/classes/capabilities-groups-manager.php:121
71
+ #: ../includes/classes/user-role-editor.php:556
72
  #: ../includes/settings-template.php:36
73
  msgid "Multisite"
74
  msgstr ""
93
  msgid "Error: this word is used by WordPress as a role ID"
94
  msgstr ""
95
 
96
+ #: ../includes/classes/capability.php:79 ../includes/classes/capability.php:190
97
+ #: ../includes/classes/editor.php:749 ../includes/classes/editor.php:818
98
+ #: ../includes/classes/editor.php:878 ../includes/classes/editor.php:1024
99
+ #: ../includes/classes/editor.php:1066
100
+ #: ../includes/classes/user-role-editor.php:650
101
  msgid "Insufficient permissions to work with User Role Editor"
102
  msgstr ""
103
 
104
+ #: ../includes/classes/capability.php:84
105
+ msgid "Wrong Request"
106
+ msgstr ""
107
+
108
+ #: ../includes/classes/capability.php:99
109
  #, php-format
110
  msgid "Capability %s was added successfully"
111
  msgstr ""
112
 
113
+ #: ../includes/classes/capability.php:101
114
  #, php-format
115
  msgid "Capability %s exists already"
116
  msgstr ""
117
 
118
+ #: ../includes/classes/capability.php:197
119
+ #: ../includes/classes/capability.php:202
120
  msgid "There are no capabilities available for deletion!"
121
  msgstr ""
122
 
123
+ #: ../includes/classes/capability.php:208
124
  #, php-format
125
  msgid "Capability %s was removed successfully"
126
  msgstr ""
127
 
128
+ #: ../includes/classes/capability.php:212
129
  msgid "capabilities were removed successfully"
130
  msgstr ""
131
 
181
  "characters to it."
182
  msgstr ""
183
 
184
+ #: ../includes/classes/editor.php:831
185
  #, php-format
186
  msgid "Role %s exists already"
187
  msgstr ""
188
 
189
+ #: ../includes/classes/editor.php:850
190
  msgid "Error is encountered during new role create operation"
191
  msgstr ""
192
 
193
+ #: ../includes/classes/editor.php:857
194
  #, php-format
195
  msgid "Role %s is created successfully"
196
  msgstr ""
197
 
198
+ #: ../includes/classes/editor.php:890
199
  msgid "Error: Empty role display name is not allowed."
200
  msgstr ""
201
 
202
+ #: ../includes/classes/editor.php:897
203
  #, php-format
204
  msgid "Role %s does not exists"
205
  msgstr ""
206
 
207
+ #: ../includes/classes/editor.php:910
208
  #, php-format
209
  msgid "Role %s is renamed to %s successfully"
210
  msgstr ""
211
 
212
+ #: ../includes/classes/editor.php:975
 
 
 
 
213
  msgid "Role does not exist"
214
  msgstr ""
215
 
216
+ #: ../includes/classes/editor.php:979
217
  msgid "You can not delete role"
218
  msgstr ""
219
 
220
+ #: ../includes/classes/editor.php:1005
221
+ msgid "There are no roles for deletion"
222
+ msgstr ""
223
+
224
+ #: ../includes/classes/editor.php:1033
225
+ msgid "Wrong role ID"
226
+ msgstr ""
227
+
228
+ #: ../includes/classes/editor.php:1042
229
  msgid "Unused roles are deleted successfully"
230
  msgstr ""
231
 
232
+ #: ../includes/classes/editor.php:1044
233
  #, php-format
234
  msgid "Role %s is deleted successfully"
235
  msgstr ""
236
 
237
+ #: ../includes/classes/editor.php:1072
 
 
 
 
238
  msgid ""
239
  "This method is only for the single site of WordPress multisite installation."
240
  msgstr ""
241
 
242
+ #: ../includes/classes/editor.php:1076
243
  msgid "Wrong request. Default role can not be empty"
244
  msgstr ""
245
 
246
+ #: ../includes/classes/editor.php:1088
247
  #, php-format
248
  msgid "Default role for new users is set to %s successfully"
249
  msgstr ""
250
 
251
+ #: ../includes/classes/editor.php:1090
252
  msgid "Error encountered during default role change operation"
253
  msgstr ""
254
 
255
+ #: ../includes/classes/editor.php:1093
256
  msgid "Can not set Administrator role as a default one"
257
  msgstr ""
258
 
259
+ #: ../includes/classes/editor.php:1095
260
  msgid "This role does not exist - "
261
  msgstr ""
262
 
263
+ #: ../includes/classes/editor.php:1144
264
  msgid "User Roles are restored to WordPress default values. "
265
  msgstr ""
266
 
267
+ #: ../includes/classes/editor.php:1276
268
  msgid "Error: wrong request"
269
  msgstr ""
270
 
271
+ #: ../includes/classes/editor.php:1305
272
  msgid "Editor"
273
  msgstr ""
274
 
275
+ #: ../includes/classes/editor.php:1306
276
  msgid "Author"
277
  msgstr ""
278
 
279
+ #: ../includes/classes/editor.php:1307
280
  msgid "Contributor"
281
  msgstr ""
282
 
283
+ #: ../includes/classes/editor.php:1308
284
  msgid "Subscriber"
285
  msgstr ""
286
 
287
+ #: ../includes/classes/editor.php:1310
288
  msgid "Switch themes"
289
  msgstr ""
290
 
291
+ #: ../includes/classes/editor.php:1311
292
  msgid "Edit themes"
293
  msgstr ""
294
 
295
+ #: ../includes/classes/editor.php:1312
296
  msgid "Activate plugins"
297
  msgstr ""
298
 
299
+ #: ../includes/classes/editor.php:1313
300
  msgid "Edit plugins"
301
  msgstr ""
302
 
303
+ #: ../includes/classes/editor.php:1314
304
  msgid "Edit users"
305
  msgstr ""
306
 
307
+ #: ../includes/classes/editor.php:1315
308
  msgid "Edit files"
309
  msgstr ""
310
 
311
+ #: ../includes/classes/editor.php:1316
312
  msgid "Manage options"
313
  msgstr ""
314
 
315
+ #: ../includes/classes/editor.php:1317
316
  msgid "Moderate comments"
317
  msgstr ""
318
 
319
+ #: ../includes/classes/editor.php:1318
320
  msgid "Manage categories"
321
  msgstr ""
322
 
323
+ #: ../includes/classes/editor.php:1319
324
  msgid "Manage links"
325
  msgstr ""
326
 
327
+ #: ../includes/classes/editor.php:1320
328
  msgid "Upload files"
329
  msgstr ""
330
 
331
+ #: ../includes/classes/editor.php:1321
332
  msgid "Import"
333
  msgstr ""
334
 
335
+ #: ../includes/classes/editor.php:1322
336
  msgid "Unfiltered html"
337
  msgstr ""
338
 
339
+ #: ../includes/classes/editor.php:1323
340
  msgid "Edit posts"
341
  msgstr ""
342
 
343
+ #: ../includes/classes/editor.php:1324
344
  msgid "Edit others posts"
345
  msgstr ""
346
 
347
+ #: ../includes/classes/editor.php:1325
348
  msgid "Edit published posts"
349
  msgstr ""
350
 
351
+ #: ../includes/classes/editor.php:1326
352
  msgid "Publish posts"
353
  msgstr ""
354
 
355
+ #: ../includes/classes/editor.php:1327
356
  msgid "Edit pages"
357
  msgstr ""
358
 
359
+ #: ../includes/classes/editor.php:1328
360
  msgid "Read"
361
  msgstr ""
362
 
363
+ #: ../includes/classes/editor.php:1329
364
  msgid "Level 10"
365
  msgstr ""
366
 
367
+ #: ../includes/classes/editor.php:1330
368
  msgid "Level 9"
369
  msgstr ""
370
 
371
+ #: ../includes/classes/editor.php:1331
372
  msgid "Level 8"
373
  msgstr ""
374
 
375
+ #: ../includes/classes/editor.php:1332
376
  msgid "Level 7"
377
  msgstr ""
378
 
379
+ #: ../includes/classes/editor.php:1333
380
  msgid "Level 6"
381
  msgstr ""
382
 
383
+ #: ../includes/classes/editor.php:1334
384
  msgid "Level 5"
385
  msgstr ""
386
 
387
+ #: ../includes/classes/editor.php:1335
388
  msgid "Level 4"
389
  msgstr ""
390
 
391
+ #: ../includes/classes/editor.php:1336
392
  msgid "Level 3"
393
  msgstr ""
394
 
395
+ #: ../includes/classes/editor.php:1337
396
  msgid "Level 2"
397
  msgstr ""
398
 
399
+ #: ../includes/classes/editor.php:1338
400
  msgid "Level 1"
401
  msgstr ""
402
 
403
+ #: ../includes/classes/editor.php:1339
404
  msgid "Level 0"
405
  msgstr ""
406
 
407
+ #: ../includes/classes/editor.php:1340
408
  msgid "Edit others pages"
409
  msgstr ""
410
 
411
+ #: ../includes/classes/editor.php:1341
412
  msgid "Edit published pages"
413
  msgstr ""
414
 
415
+ #: ../includes/classes/editor.php:1342
416
  msgid "Publish pages"
417
  msgstr ""
418
 
419
+ #: ../includes/classes/editor.php:1343
420
  msgid "Delete pages"
421
  msgstr ""
422
 
423
+ #: ../includes/classes/editor.php:1344
424
  msgid "Delete others pages"
425
  msgstr ""
426
 
427
+ #: ../includes/classes/editor.php:1345
428
  msgid "Delete published pages"
429
  msgstr ""
430
 
431
+ #: ../includes/classes/editor.php:1346
432
  msgid "Delete posts"
433
  msgstr ""
434
 
435
+ #: ../includes/classes/editor.php:1347
436
  msgid "Delete others posts"
437
  msgstr ""
438
 
439
+ #: ../includes/classes/editor.php:1348
440
  msgid "Delete published posts"
441
  msgstr ""
442
 
443
+ #: ../includes/classes/editor.php:1349
444
  msgid "Delete private posts"
445
  msgstr ""
446
 
447
+ #: ../includes/classes/editor.php:1350
448
  msgid "Edit private posts"
449
  msgstr ""
450
 
451
+ #: ../includes/classes/editor.php:1351
452
  msgid "Read private posts"
453
  msgstr ""
454
 
455
+ #: ../includes/classes/editor.php:1352
456
  msgid "Delete private pages"
457
  msgstr ""
458
 
459
+ #: ../includes/classes/editor.php:1353
460
  msgid "Edit private pages"
461
  msgstr ""
462
 
463
+ #: ../includes/classes/editor.php:1354
464
  msgid "Read private pages"
465
  msgstr ""
466
 
467
+ #: ../includes/classes/editor.php:1355
468
  msgid "Delete users"
469
  msgstr ""
470
 
471
+ #: ../includes/classes/editor.php:1356
472
  msgid "Create users"
473
  msgstr ""
474
 
475
+ #: ../includes/classes/editor.php:1357
476
  msgid "Unfiltered upload"
477
  msgstr ""
478
 
479
+ #: ../includes/classes/editor.php:1358
480
  msgid "Edit dashboard"
481
  msgstr ""
482
 
483
+ #: ../includes/classes/editor.php:1359
484
  msgid "Update plugins"
485
  msgstr ""
486
 
487
+ #: ../includes/classes/editor.php:1360
488
  msgid "Delete plugins"
489
  msgstr ""
490
 
491
+ #: ../includes/classes/editor.php:1361
492
  msgid "Install plugins"
493
  msgstr ""
494
 
495
+ #: ../includes/classes/editor.php:1362
496
  msgid "Update themes"
497
  msgstr ""
498
 
499
+ #: ../includes/classes/editor.php:1363
500
  msgid "Install themes"
501
  msgstr ""
502
 
503
+ #: ../includes/classes/editor.php:1364
504
  msgid "Update core"
505
  msgstr ""
506
 
507
+ #: ../includes/classes/editor.php:1365
508
  msgid "List users"
509
  msgstr ""
510
 
511
+ #: ../includes/classes/editor.php:1366
512
  msgid "Remove users"
513
  msgstr ""
514
 
515
+ #: ../includes/classes/editor.php:1367
516
  msgid "Add users"
517
  msgstr ""
518
 
519
+ #: ../includes/classes/editor.php:1368
520
  msgid "Promote users"
521
  msgstr ""
522
 
523
+ #: ../includes/classes/editor.php:1369
524
  msgid "Edit theme options"
525
  msgstr ""
526
 
527
+ #: ../includes/classes/editor.php:1370
528
  msgid "Delete themes"
529
  msgstr ""
530
 
531
+ #: ../includes/classes/editor.php:1371
532
  msgid "Export"
533
  msgstr ""
534
 
573
  msgid "Other Roles: "
574
  msgstr ""
575
 
576
+ #: ../includes/classes/grant-roles.php:441
577
  msgid "Grant Roles"
578
  msgstr ""
579
 
580
+ #: ../includes/classes/grant-roles.php:443
581
+ #: ../includes/classes/grant-roles.php:445
582
  msgid "Add role&hellip;"
583
  msgstr ""
584
 
585
+ #: ../includes/classes/grant-roles.php:448
586
  msgid "Add"
587
  msgstr ""
588
 
589
+ #: ../includes/classes/grant-roles.php:450
590
+ #: ../includes/classes/grant-roles.php:452
591
  msgid "Revoke role&hellip;"
592
  msgstr ""
593
 
594
+ #: ../includes/classes/grant-roles.php:455
595
  msgid "Revoke"
596
  msgstr ""
597
 
598
+ #: ../includes/classes/grant-roles.php:487
599
  msgid "Grant roles to selected users"
600
  msgstr ""
601
 
602
+ #: ../includes/classes/grant-roles.php:488
603
  msgid "Select users to which you wish to grant roles!"
604
  msgstr ""
605
 
606
+ #: ../includes/classes/grant-roles.php:489
607
  msgid "Select role(s) which you wish to grant!"
608
  msgstr ""
609
 
610
+ #: ../includes/classes/lib.php:380
611
  msgid "Version:"
612
  msgstr ""
613
 
614
+ #: ../includes/classes/lib.php:381
615
  msgid "Author's website"
616
  msgstr ""
617
 
618
+ #: ../includes/classes/lib.php:382
619
  msgid "Plugin webpage"
620
  msgstr ""
621
 
622
+ #: ../includes/classes/lib.php:383
623
  msgid "Plugin download"
624
  msgstr ""
625
 
626
+ #: ../includes/classes/lib.php:384 ../includes/classes/user-role-editor.php:515
627
  msgid "Changelog"
628
  msgstr ""
629
 
630
+ #: ../includes/classes/lib.php:385
631
  msgid "FAQ"
632
  msgstr ""
633
 
639
  msgid "Additional Options"
640
  msgstr ""
641
 
642
+ #: ../includes/classes/role-view.php:75
643
  msgid "None"
644
  msgstr ""
645
 
646
+ #: ../includes/classes/role-view.php:112
647
  msgid "Delete All Unused Roles"
648
  msgstr ""
649
 
650
+ #: ../includes/classes/role-view.php:212 ../includes/classes/role-view.php:223
651
  msgid "Role name (ID): "
652
  msgstr ""
653
 
654
+ #: ../includes/classes/role-view.php:214 ../includes/classes/role-view.php:225
655
  msgid "Display Role Name: "
656
  msgstr ""
657
 
658
+ #: ../includes/classes/role-view.php:216
659
  msgid "Make copy of: "
660
  msgstr ""
661
 
662
+ #: ../includes/classes/role-view.php:232
663
  msgid "Select Role:"
664
  msgstr ""
665
 
666
+ #: ../includes/classes/role-view.php:257
667
  msgid "Capability name (ID): "
668
  msgstr ""
669
 
670
+ #: ../includes/classes/role-view.php:369 ../includes/classes/user-view.php:154
671
  msgid "Show capabilities in human readable form"
672
  msgstr ""
673
 
674
+ #: ../includes/classes/role-view.php:379 ../includes/classes/screen-help.php:21
675
  #: ../includes/classes/user-view.php:164 ../includes/settings-template.php:78
676
  msgid "Show deprecated capabilities"
677
  msgstr ""
678
 
679
+ #: ../includes/classes/role-view.php:383
680
  msgid "If checked, then apply action to ALL sites of this Network"
681
  msgstr ""
682
 
683
+ #: ../includes/classes/role-view.php:396 ../includes/classes/tools.php:30
684
  msgid "Apply to All Sites"
685
  msgstr ""
686
 
687
+ #: ../includes/classes/role-view.php:413
688
  msgid "Select Role and change its capabilities:"
689
  msgstr ""
690
 
819
  msgstr ""
820
 
821
  #: ../includes/classes/tools.php:36
822
+ #: ../includes/classes/user-role-editor.php:787
823
  msgid "Reset"
824
  msgstr ""
825
 
828
  msgstr ""
829
 
830
  #: ../includes/classes/user-other-roles.php:85
831
+ #: ../includes/classes/user-other-roles.php:221
832
  msgid "Other Roles"
833
  msgstr ""
834
 
836
  msgid "Select additional roles for this user"
837
  msgstr ""
838
 
839
+ #: ../includes/classes/user-other-roles.php:183
840
  #, php-format
841
  msgid "Denied: %s"
842
  msgstr ""
843
 
844
+ #: ../includes/classes/user-other-roles.php:200
845
+ #: ../includes/classes/user-role-editor.php:391
846
  msgid "Capabilities"
847
  msgstr ""
848
 
849
+ #: ../includes/classes/user-other-roles.php:207
850
  msgid "Edit"
851
  msgstr ""
852
 
853
+ #: ../includes/classes/user-other-roles.php:265
854
  msgid "Additional Capabilities"
855
  msgstr ""
856
 
857
+ #: ../includes/classes/user-role-editor.php:288
858
  msgid "Change role for users without role"
859
  msgstr ""
860
 
861
+ #: ../includes/classes/user-role-editor.php:289
862
  msgid "To:"
863
  msgstr ""
864
 
865
+ #: ../includes/classes/user-role-editor.php:290
866
  msgid "No rights"
867
  msgstr ""
868
 
869
+ #: ../includes/classes/user-role-editor.php:291
870
  msgid "Provide new role"
871
  msgstr ""
872
 
873
+ #: ../includes/classes/user-role-editor.php:363
874
+ #: ../includes/classes/user-role-editor.php:365
875
  msgid "You do not have permission to edit this user."
876
  msgstr ""
877
 
 
878
  #: ../includes/classes/user-role-editor.php:489
879
+ #: ../includes/classes/user-role-editor.php:502
880
  msgid "Settings"
881
  msgstr ""
882
 
883
+ #: ../includes/classes/user-role-editor.php:544
884
  #: ../includes/settings-template.php:26
885
  msgid "Additional Modules"
886
  msgstr ""
887
 
888
+ #: ../includes/classes/user-role-editor.php:550
889
  #: ../includes/settings-template.php:31
890
  msgid "Default Roles"
891
  msgstr ""
892
 
893
+ #: ../includes/classes/user-role-editor.php:617
894
  msgid ""
895
  "You do not have sufficient permissions to manage options for User Role "
896
  "Editor."
897
  msgstr ""
898
 
899
+ #: ../includes/classes/user-role-editor.php:737
900
+ #: ../includes/classes/user-role-editor.php:784
901
  msgid "Confirm"
902
  msgstr ""
903
 
904
+ #: ../includes/classes/user-role-editor.php:738
905
+ #: ../includes/classes/user-role-editor.php:785
906
  msgid "Yes"
907
  msgstr ""
908
 
909
+ #: ../includes/classes/user-role-editor.php:739
910
+ #: ../includes/classes/user-role-editor.php:786
911
  msgid "No"
912
  msgstr ""
913
 
914
+ #: ../includes/classes/user-role-editor.php:740
915
  msgid "Update"
916
  msgstr ""
917
 
918
+ #: ../includes/classes/user-role-editor.php:741
919
  msgid "Please confirm permissions update"
920
  msgstr ""
921
 
922
+ #: ../includes/classes/user-role-editor.php:742
923
  msgid "Add New Role"
924
  msgstr ""
925
 
926
+ #: ../includes/classes/user-role-editor.php:743
927
+ #: ../includes/classes/user-role-editor.php:748
928
  msgid "Rename Role"
929
  msgstr ""
930
 
931
+ #: ../includes/classes/user-role-editor.php:744
932
  msgid " Role name (ID) can not be empty!"
933
  msgstr ""
934
 
935
+ #: ../includes/classes/user-role-editor.php:745
936
  msgid ""
937
  " Role name (ID) must contain latin characters, digits, hyphens or underscore "
938
  "only!"
939
  msgstr ""
940
 
941
+ #: ../includes/classes/user-role-editor.php:746
942
  msgid ""
943
  " WordPress does not support numeric Role name (ID). Add latin characters to "
944
  "it."
945
  msgstr ""
946
 
947
+ #: ../includes/classes/user-role-editor.php:747
948
  msgid "Add Role"
949
  msgstr ""
950
 
951
+ #: ../includes/classes/user-role-editor.php:749
952
  msgid "Delete Role"
953
  msgstr ""
954
 
955
+ #: ../includes/classes/user-role-editor.php:750
956
  msgid "Cancel"
957
  msgstr ""
958
 
959
+ #: ../includes/classes/user-role-editor.php:751
960
  msgid "Add Capability"
961
  msgstr ""
962
 
963
+ #: ../includes/classes/user-role-editor.php:752
964
+ #: ../includes/classes/user-role-editor.php:756
965
  msgid "Delete Capability"
966
  msgstr ""
967
 
968
+ #: ../includes/classes/user-role-editor.php:753
969
+ #: ../includes/classes/user-role-editor.php:793
970
  msgid "Continue?"
971
  msgstr ""
972
 
973
+ #: ../includes/classes/user-role-editor.php:754
974
  msgid "Default Role"
975
  msgstr ""
976
 
977
+ #: ../includes/classes/user-role-editor.php:755
978
  msgid "Set New Default Role"
979
  msgstr ""
980
 
981
+ #: ../includes/classes/user-role-editor.php:757
982
  msgid ""
983
  "Warning! Be careful - removing critical capability could crash some plugin "
984
  "or other custom code"
985
  msgstr ""
986
 
987
+ #: ../includes/classes/user-role-editor.php:758
988
  msgid " Capability name (ID) can not be empty!"
989
  msgstr ""
990
 
991
+ #: ../includes/classes/user-role-editor.php:759
992
  msgid ""
993
  " Capability name (ID) must contain latin characters, digits, hyphens or "
994
  "underscore only!"
995
  msgstr ""
996
 
997
+ #: ../includes/classes/user-role-editor.php:788
998
  msgid "DANGER!"
999
  msgstr ""
1000
 
1001
+ #: ../includes/classes/user-role-editor.php:789
1002
  msgid ""
1003
  " Resetting will restore default user roles and capabilities from WordPress "
1004
  "core."
1005
  msgstr ""
1006
 
1007
+ #: ../includes/classes/user-role-editor.php:790
1008
  msgid ""
1009
  "If any plugins (such as WooCommerce, S2Member and many others) have changed "
1010
  "user roles and capabilities during installation, all those changes will be "
1011
  "LOST!"
1012
  msgstr ""
1013
 
1014
+ #: ../includes/classes/user-role-editor.php:791
1015
  msgid ""
1016
  "For more information on how to undo undesired changes and restore plugin "
1017
  "capabilities go to"
1041
  msgid "Other Roles:"
1042
  msgstr ""
1043
 
1044
+ #: ../includes/classes/view.php:289
1045
  msgid "Working..."
1046
  msgstr ""
1047
 
1048
+ #: ../includes/classes/view.php:320
1049
  msgid "Group"
1050
  msgstr ""
1051
 
1052
+ #: ../includes/classes/view.php:320
1053
  msgid "Total"
1054
  msgstr ""
1055
 
1056
+ #: ../includes/classes/view.php:320
1057
  msgid "Granted"
1058
  msgstr ""
1059
 
1060
+ #: ../includes/classes/view.php:333
1061
  msgid "Quick filter:"
1062
  msgstr ""
1063
 
1064
+ #: ../includes/classes/view.php:336
1065
  msgid "Granted Only"
1066
  msgstr ""
1067
 
1068
+ #: ../includes/classes/view.php:339
1069
  msgid "Columns:"
1070
  msgstr ""
1071
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladi
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
  Tested up to: 5.3.2
7
- Stable tag: 4.52.2
8
  Requires PHP: 5.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -81,6 +81,11 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
81
 
82
  == Changelog =
83
 
 
 
 
 
 
84
  = [4.52.2] 26.12.2019 =
85
  * Fix: Custom capabilities for custom post types was not created by URE automatically since version 4.52.1.
86
  * Fix: 'administrator' role protection did not show to power users roles with 'administrator' word inside, like 'shop_administrator', etc.
@@ -90,9 +95,6 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
90
  * ure_cpt_editor_roles filter was added. It takes 2 parameters: array $roles with 1 element 'administrator' by default and $post_type with post type name string. Add other role(s) to which you wish automatically add all user capabilities for custom post type $post_type. URE updates roles this way before opening "Users->User Role Editor" page.
91
  * New user capability 'ure_nav_menus_access' was added. It's used at the User Role Editor Pro only.
92
 
93
- = [4.52] 07.10.2019 =
94
- * New: Multisite: WordPress (tested up to version 5.2.3) shows "Change role to..." drop-down list at "Network Admin->Sites->selected site->Users tab" with roles filled from the main site, but should use roles list from the selected site. URE replaces this roles list with roles from the selected site and excludes error with message "Sorry, you are not allowed to give users that role.", when you try to grant to a user a role from the main site, which does not exist at the selected site.
95
-
96
  File changelog.txt contains the full list of changes.
97
 
98
  == Additional Documentation ==
@@ -102,8 +104,6 @@ You can find more information about "User Role Editor" plugin at [this page](htt
102
  I am ready to answer on your questions about plugin usage. Use [plugin page comments](http://www.shinephp.com/user-role-editor-wordpress-plugin/) for that.
103
 
104
  == Upgrade Notice ==
105
-
106
- = [4.52.1] 11.11.2019 =
107
- * Update: URE requires PHP version 5.6.
108
- * ure_cpt_editor_roles filter was added. It takes 2 parameters: array $roles with 1 element 'administrator' by default and $post_type with post type name string. Add other role(s) to which you wish automatically add all user capabilities for custom post type $post_type. URE updates roles this way before opening "Users->User Role Editor" page.
109
- * New user capability 'ure_nav_menus_access' was added. It's used at the User Role Editor Pro only.
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
  Tested up to: 5.3.2
7
+ Stable tag: 4.53
8
  Requires PHP: 5.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
81
 
82
  == Changelog =
83
 
84
+ = [4.53] 01.02.2019 =
85
+ * Update: "Add role", "Delete role", "Rename role", "Add capability", "Delete capability" do not reload full page on completion, but use AJAX for data exchange with server and refresh parts of the page via JavaScript.
86
+ * Update: Multisite: "Allow non super administrators to create, edit, and delete users" option: priority for 'map_meta_cap' filter priority was raised from 1 to 99, in order make possible to overwrite changes made by other plugins, like WooCommerce.
87
+ * Fix: Some English grammar mistakes.
88
+
89
  = [4.52.2] 26.12.2019 =
90
  * Fix: Custom capabilities for custom post types was not created by URE automatically since version 4.52.1.
91
  * Fix: 'administrator' role protection did not show to power users roles with 'administrator' word inside, like 'shop_administrator', etc.
95
  * ure_cpt_editor_roles filter was added. It takes 2 parameters: array $roles with 1 element 'administrator' by default and $post_type with post type name string. Add other role(s) to which you wish automatically add all user capabilities for custom post type $post_type. URE updates roles this way before opening "Users->User Role Editor" page.
96
  * New user capability 'ure_nav_menus_access' was added. It's used at the User Role Editor Pro only.
97
 
 
 
 
98
  File changelog.txt contains the full list of changes.
99
 
100
  == Additional Documentation ==
104
  I am ready to answer on your questions about plugin usage. Use [plugin page comments](http://www.shinephp.com/user-role-editor-wordpress-plugin/) for that.
105
 
106
  == Upgrade Notice ==
107
+ = [4.53] 01.02.2019 =
108
+ * Update: "Add role", "Delete role", "Rename role", "Add capability", "Delete capability" do not reload full page on completion, but use AJAX for data exchange with server and refresh parts of the page via JavaScript.
109
+ * Update: Multisite: "Allow non super administrators to create, edit, and delete users" option: priority for 'map_meta_cap' filter priority was raised from 1 to 99, in order make possible to overwrite changes made by other plugins, like WooCommerce.
 
 
user-role-editor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: User Role Editor
4
  Plugin URI: https://www.role-editor.com
5
  Description: Change/add/delete WordPress user roles and capabilities.
6
- Version: 4.52.2
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: user-role-editor
@@ -23,7 +23,7 @@ if ( defined( 'URE_PLUGIN_URL' ) ) {
23
  wp_die( 'It seems that other version of User Role Editor is active. Please deactivate it before use this version' );
24
  }
25
 
26
- define( 'URE_VERSION', '4.52.2' );
27
  define( 'URE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
28
  define( 'URE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
29
  define( 'URE_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
3
  Plugin Name: User Role Editor
4
  Plugin URI: https://www.role-editor.com
5
  Description: Change/add/delete WordPress user roles and capabilities.
6
+ Version: 4.53
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: user-role-editor
23
  wp_die( 'It seems that other version of User Role Editor is active. Please deactivate it before use this version' );
24
  }
25
 
26
+ define( 'URE_VERSION', '4.53' );
27
  define( 'URE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
28
  define( 'URE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
29
  define( 'URE_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );