User Role Editor - Version 4.26

Version Description

Download this release

Release Info

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

Code changes from version 4.25.2 to 4.26

css/ure-admin.css CHANGED
@@ -89,8 +89,14 @@ input.warning:hover, a.warning:hover {
89
  float: left;
90
  }
91
 
 
 
 
 
 
92
  #ure_toolbar {
93
  float: right;
 
94
  margin-left: 5px;
95
  border: 1px solid #dfdfdf;
96
  -webkit-box-shadow: inset 0 1px 0 #fff;
@@ -99,24 +105,21 @@ input.warning:hover, a.warning:hover {
99
  border-radius: 3px;
100
  background: #f5f5f5;
101
  padding: 5px;
102
- max-width: 145px;
 
103
  }
104
 
105
  .ure_toolbar_button {
106
- width: 143px;
 
107
  }
108
 
109
  #ure_update {
110
- margin-top: 10px;
111
- margin-bottom: 10px;
112
- }
113
-
114
- #ure_update_user {
115
- margin-top: 190px;
116
- margin-bottom: 190px;
117
  }
118
 
119
-
120
  #ure_service_tools {
121
  margin-top: 10px;
122
  }
@@ -145,9 +148,10 @@ input.warning:hover, a.warning:hover {
145
  padding-right: 10px;
146
  padding-top: 5px;
147
  font-size: 1.1em;
148
- border-top: 1px solid #ccc;
149
- border-right: 1px solid #ccc;
150
  min-width: 120px;
 
151
  }
152
 
153
  /* Multipe select */
@@ -167,6 +171,12 @@ input.warning:hover, a.warning:hover {
167
  background-color:Yellow;
168
  }
169
 
 
 
 
 
 
 
170
  #ure-icon {
171
  background-image: url("../images/user-role-editor-page-icon.png");
172
  background-position: 0 0;
@@ -184,4 +194,43 @@ input.warning:hover, a.warning:hover {
184
  #ure_admin_menu_access_table tr:hover {
185
  background-color: #2ea2cc;
186
  color: #ffffff;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  }
89
  float: left;
90
  }
91
 
92
+ #ure_role_caps {
93
+ width: 100%;
94
+
95
+ }
96
+
97
  #ure_toolbar {
98
  float: right;
99
+ margin-top: 10px;
100
  margin-left: 5px;
101
  border: 1px solid #dfdfdf;
102
  -webkit-box-shadow: inset 0 1px 0 #fff;
105
  border-radius: 3px;
106
  background: #f5f5f5;
107
  padding: 5px;
108
+ max-width: 185px;
109
+ min-width: 185px;
110
  }
111
 
112
  .ure_toolbar_button {
113
+ width: 100%;
114
+ margin-bottom: 3px;
115
  }
116
 
117
  #ure_update {
118
+ width: 100%;
119
+ margin-top: 10px;
120
+ margin-bottom: 10px;
 
 
 
 
121
  }
122
 
 
123
  #ure_service_tools {
124
  margin-top: 10px;
125
  }
148
  padding-right: 10px;
149
  padding-top: 5px;
150
  font-size: 1.1em;
151
+ border-top: 1px solid #cccccc;
152
+ border-right: 1px solid #cccccc;
153
  min-width: 120px;
154
+ width: 25%;
155
  }
156
 
157
  /* Multipe select */
171
  background-color:Yellow;
172
  }
173
 
174
+ .ure-caps-cell {
175
+ vertical-align:top;
176
+ padding-top: 5px;
177
+ }
178
+
179
+
180
  #ure-icon {
181
  background-image: url("../images/user-role-editor-page-icon.png");
182
  background-position: 0 0;
194
  #ure_admin_menu_access_table tr:hover {
195
  background-color: #2ea2cc;
196
  color: #ffffff;
197
+ }
198
+
199
+
200
+ #ure_role_caps_groups_title {
201
+ width: 200px;
202
+ vertical-align:middle;
203
+ font-weight: bold;
204
+ border-bottom: 1px solid #cccccc;
205
+ }
206
+
207
+ #ure_role_caps_select {
208
+ vertical-align:middle;
209
+ border-bottom: 1px solid #cccccc;
210
+ }
211
+
212
+ #ure_role_caps_quick_filter {
213
+ vertical-align:middle;
214
+ text-align: right;
215
+ padding-bottom: 5px;
216
+ border-bottom: 1px solid #cccccc;
217
+ }
218
+
219
+ #ure_caps_groups_list .ui-selecting {
220
+ background: #DDDDDD;
221
+ }
222
+
223
+ #ure_caps_groups_list .ui-selected {
224
+ background: #CCCCCC;
225
+ color: #444444;
226
+ }
227
+
228
+ #ure_caps_groups_list li {
229
+ height: 20px;
230
+ line-height: 20px;
231
+ cursor: pointer;
232
+ }
233
+
234
+ .plugins {
235
+ color: #444444;
236
  }
includes/classes/advertisement.php CHANGED
@@ -10,19 +10,16 @@
10
 
11
  class URE_Advertisement {
12
 
13
- private $slots = array(0=>'', 1=>'', 2=>'');
14
 
15
  function __construct() {
16
 
17
  $used = array(-1);
18
- $index = $this->rand_unique( $used );
 
19
  $this->slots[$index] = $this->admin_menu_editor();
20
  $used[] = $index;
21
-
22
- $index = $this->rand_unique( $used );
23
- $this->slots[$index] = $this->wp_esignature();
24
- $used[] = $index;
25
-
26
  }
27
  // end of __construct
28
 
@@ -59,23 +56,7 @@ class URE_Advertisement {
59
  return $output;
60
  }
61
  // end of admin_menu_editor()
62
-
63
-
64
- // content of WP eSignature advertisement slot
65
- private function wp_esignature() {
66
-
67
- $output = '
68
- <div style="text-align: center;">
69
- <a title="WP E-Signature" href="https://www.approveme.me/?utm_source=role-editor&utm_medium=250x250&utm_term=get%20contracts%20signed%205x%20faster%20with%20wordpress&utm_content=v1&utm_campaign=role-editor" target="_new" >
70
- <img width="250" height="250" alt="WP E-Signature" src="'. URE_PLUGIN_URL .'images/wp-esignature.png">
71
- </a>
72
- </div>
73
- ';
74
-
75
- return $output;
76
- }
77
- // end of manage_wp()
78
-
79
 
80
  /**
81
  * Output all existed ads slots
10
 
11
  class URE_Advertisement {
12
 
13
+ private $slots = array(0=>'');
14
 
15
  function __construct() {
16
 
17
  $used = array(-1);
18
+ //$index = $this->rand_unique( $used );
19
+ $index = 0;
20
  $this->slots[$index] = $this->admin_menu_editor();
21
  $used[] = $index;
22
+
 
 
 
 
23
  }
24
  // end of __construct
25
 
56
  return $output;
57
  }
58
  // end of admin_menu_editor()
59
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
  /**
62
  * Output all existed ads slots
includes/classes/base-lib.php CHANGED
@@ -16,9 +16,9 @@ class URE_Base_Lib {
16
  protected static $instance = null; // object exemplar reference
17
  protected $options_id = ''; // identifire to save/retrieve plugin options to/from wp_option DB table
18
  protected $options = array(); // plugin options data
19
- public $multisite = false;
20
- public $active_for_network = false;
21
- public $blog_ids = null;
22
  protected $main_blog_id = 0;
23
 
24
 
@@ -30,33 +30,11 @@ class URE_Base_Lib {
30
  return self::$instance;
31
  }
32
  // end of get_instance()
33
-
34
- /**
35
- * Every child class should override get_instance() method with its own version for compatibility purpose.
36
- * We do not use the only get_instance() method at the base class for the compatibility with PHP 5.2,
37
- * as get_called_class() function and 'late static binding' is available for PHP 5.3+ only.
38
- *
39
- public static function get_instance($options_id = '') {
40
-
41
- $class = get_called_class();
42
- if (self::$instance === null) {
43
- if (empty($options_id)) {
44
- throw new Exception($class . '::get_inctance() - Error: plugin options ID string is required');
45
- }
46
- // new static() will work too
47
- self::$instance = new $class($options_id);
48
- }
49
-
50
- return self::$instance;
51
- }
52
- // end of get_instance()
53
-
54
- **/
55
-
56
 
57
  /**
58
  * class constructor
59
- * @param string $option_name identifire to save/retrieve plugin options to/from wp_option DB table
60
  */
61
  protected function __construct($options_id) {
62
 
@@ -64,15 +42,35 @@ class URE_Base_Lib {
64
  if ($this->multisite) {
65
  $this->blog_ids = $this->get_blog_ids();
66
  // get Id of 1st (main) blog
67
- $this->main_blog_id = $this->blog_ids[0][0];
68
  }
69
 
70
  $this->init_options($options_id);
71
 
72
  }
73
  // end of __construct()
 
 
 
 
 
 
 
 
 
 
 
74
 
75
 
 
 
 
 
 
 
 
 
 
76
  /**
77
  * Returns the array of multisite WP blogs IDs
78
  * @global wpdb $wpdb
16
  protected static $instance = null; // object exemplar reference
17
  protected $options_id = ''; // identifire to save/retrieve plugin options to/from wp_option DB table
18
  protected $options = array(); // plugin options data
19
+ protected $multisite = false;
20
+ protected $active_for_network = false;
21
+ protected $blog_ids = null;
22
  protected $main_blog_id = 0;
23
 
24
 
30
  return self::$instance;
31
  }
32
  // end of get_instance()
33
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
  /**
36
  * class constructor
37
+ * @param string $options_id to save/retrieve plugin options to/from wp_option DB table
38
  */
39
  protected function __construct($options_id) {
40
 
42
  if ($this->multisite) {
43
  $this->blog_ids = $this->get_blog_ids();
44
  // get Id of 1st (main) blog
45
+ $this->main_blog_id = $this->get_main_site();
46
  }
47
 
48
  $this->init_options($options_id);
49
 
50
  }
51
  // end of __construct()
52
+
53
+
54
+ public function get($property_name) {
55
+
56
+ if (!property_exists($this, $property_name)) {
57
+ syslog(LOG_ERR, 'URE_Lib class does not have such property '. $property_name);
58
+ }
59
+
60
+ return $this->$property_name;
61
+ }
62
+ // end of get_property()
63
 
64
 
65
+ public function get_main_site() {
66
+ global $current_site;
67
+
68
+ return $current_site->blog_id;
69
+ }
70
+ // end of get_main_site()
71
+
72
+
73
+
74
  /**
75
  * Returns the array of multisite WP blogs IDs
76
  * @global wpdb $wpdb
includes/classes/capabilities-groups-manager.php ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Class to group user capabilities for better structuring
4
+ *
5
+ * @package User-Role-Editor
6
+ * @subpackage Admin
7
+ * @author Vladimir Garagulya <support@role-editor.com>
8
+ * @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
9
+ **/
10
+
11
+ class URE_Capabilities_Groups_Manager {
12
+
13
+ private static $instance = null;
14
+ private $lib = null;
15
+ private $custom_post_types = null;
16
+
17
+
18
+ public static function get_instance() {
19
+
20
+ if (self::$instance === null) {
21
+ // new static() will work too
22
+ self::$instance = new URE_Capabilities_Groups_Manager();
23
+ }
24
+
25
+ return self::$instance;
26
+ }
27
+ // end of get_instance()
28
+
29
+
30
+ private function __construct() {
31
+
32
+ $this->lib = URE_Lib::get_instance();
33
+
34
+ }
35
+ // end of __construct()
36
+
37
+
38
+ public function add_custom_post_types() {
39
+
40
+ $this->groups['custom_post_types'] = array('caption'=>esc_html__('Custom Post Types', 'user-role-editor'), 'parent'=>'all', 'level'=>1);
41
+
42
+ $post_types = get_post_types(array(), 'objects');
43
+ $_post_types = $this->lib->_get_post_types();
44
+ $built_in_pt = array('post', 'page');
45
+ if ($post_types['attachment']->cap->edit_posts=='edit_posts') {
46
+ $built_in_pt[] = 'attachment';
47
+ }
48
+
49
+ foreach($post_types as $post_type) {
50
+ if (!isset($_post_types[$post_type->name])) {
51
+ continue;
52
+ }
53
+ if (in_array($post_type->name, $built_in_pt)) {
54
+ continue;
55
+ }
56
+ $this->groups[$post_type->name] = array('caption'=>$post_type->labels->name, 'parent'=>'custom_post_types', 'level'=>2);
57
+ }
58
+ }
59
+ // add_custom_post_types()
60
+
61
+
62
+ public function get_groups_tree() {
63
+
64
+ if ($this->groups!==null) {
65
+ return $this->groups;
66
+ }
67
+
68
+ $this->groups = array(
69
+ 'all'=>array('caption'=>esc_html__('All', 'user-role-editor'), 'parent'=>null, 'level'=>0),
70
+ 'core'=>array('caption'=>esc_html__('Core', 'user-role-editor'), 'parent'=>'all', 'level'=>1),
71
+ 'general'=>array('caption'=>esc_html__('General', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
72
+ 'themes'=>array('caption'=>esc_html__('Themes', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
73
+ 'posts'=>array('caption'=>esc_html__('Posts', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
74
+ 'pages'=>array('caption'=>esc_html__('Pages', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
75
+ 'plugins'=>array('caption'=>esc_html__('Plugins', 'user-role-editor'), 'parent'=>'core', 'level'=>2),
76
+ 'users'=>array('caption'=>esc_html__('Users', 'user-role-editor'), 'parent'=>'core', 'level'=>2)
77
+ );
78
+ $multisite = $this->lib->get('multisite');
79
+ if ($multisite) {
80
+ $this->groups['multisite'] = array('caption'=>esc_html__('Multisite', 'user-role-editor'), 'parent'=>'core', 'level'=>2);
81
+ }
82
+ $this->groups['deprecated'] = array('caption'=>esc_html__('Deprecated', 'user-role-editor'), 'parent'=>'core', 'level'=>2);
83
+
84
+ $this->add_custom_post_types();
85
+
86
+ $this->groups = apply_filters('ure_capabilities_groups_tree', $this->groups);
87
+ $this->groups['custom'] = array('caption'=>esc_html__('Custom capabilities', 'user-role-editor'), 'parent'=>'all', 'level'=>1);
88
+
89
+ return $this->groups;
90
+ }
91
+ // end of get_groups_tree()
92
+
93
+
94
+ /**
95
+ * return array of built-in WP capabilities (WP 3.1 wp-admin/includes/schema.php)
96
+ *
97
+ * @return array
98
+ */
99
+ public function get_built_in_wp_caps() {
100
+
101
+ $wp_version = get_bloginfo('version');
102
+ $multisite = $this->lib->get('multisite');
103
+
104
+ $caps = array();
105
+ $caps['switch_themes'] = array('core', 'themes');
106
+ $caps['edit_themes'] = array('core', 'themes');
107
+ $caps['activate_plugins'] = array('core', 'plugins');
108
+ $caps['edit_plugins'] = array('core', 'plugins');
109
+ $caps['edit_users'] = array('core', 'users');
110
+ $caps['edit_files'] = array('core', 'deprecated');
111
+ $caps['manage_options'] = array('core', 'general');
112
+ $caps['moderate_comments'] = array('core', 'posts', 'general');
113
+ $caps['manage_categories'] = array('core', 'posts', 'general');
114
+ $caps['manage_links'] = array('core', 'others');
115
+ $caps['upload_files'] = array('core', 'general');
116
+ $caps['import'] = array('core', 'general');
117
+ $caps['unfiltered_html'] = array('core');
118
+ if ($multisite) {
119
+ $caps['unfiltered_html'] = array('deprecated');
120
+ }
121
+ $caps['edit_posts'] = array('core', 'posts');
122
+ $caps['edit_others_posts'] = array('core', 'posts');
123
+ $caps['edit_published_posts'] = array('core', 'posts');
124
+ $caps['publish_posts'] = array('core', 'posts');
125
+ $caps['edit_pages'] = array('core', 'pages');
126
+ $caps['read'] = array('core', 'general');
127
+ $caps['level_10'] = array('core', 'deprecated');
128
+ $caps['level_9'] = array('core', 'deprecated');
129
+ $caps['level_8'] = array('core', 'deprecated');
130
+ $caps['level_7'] = array('core', 'deprecated');
131
+ $caps['level_6'] = array('core', 'deprecated');
132
+ $caps['level_5'] = array('core', 'deprecated');
133
+ $caps['level_4'] = array('core', 'deprecated');
134
+ $caps['level_3'] = array('core', 'deprecated');
135
+ $caps['level_2'] = array('core', 'deprecated');
136
+ $caps['level_1'] = array('core', 'deprecated');
137
+ $caps['level_0'] = array('core', 'deprecated');
138
+ $caps['edit_others_pages'] = array('core', 'pages');
139
+ $caps['edit_published_pages'] = array('core', 'pages');
140
+ $caps['publish_pages'] = array('core', 'pages');
141
+ $caps['delete_pages'] = array('core', 'pages');
142
+ $caps['delete_others_pages'] = array('core', 'pages');
143
+ $caps['delete_published_pages'] = array('core', 'pages');
144
+ $caps['delete_posts'] = array('core', 'posts');
145
+ $caps['delete_others_posts'] = array('core', 'posts');
146
+ $caps['delete_published_posts'] = array('core', 'posts');
147
+ $caps['delete_private_posts'] = array('core', 'posts');
148
+ $caps['edit_private_posts'] = array('core', 'posts');
149
+ $caps['read_private_posts'] = array('core', 'posts');
150
+ $caps['delete_private_pages'] = array('core', 'pages');
151
+ $caps['edit_private_pages'] = array('core', 'pages');
152
+ $caps['read_private_pages'] = array('core', 'pages');
153
+ $caps['unfiltered_upload'] = array('core', 'general');
154
+ $caps['edit_dashboard'] = array('core', 'general');
155
+ $caps['update_plugins'] = array('core', 'plugins');
156
+ $caps['delete_plugins'] = array('core', 'plugins');
157
+ $caps['install_plugins'] = array('core', 'plugins');
158
+ $caps['update_themes'] = array('core', 'themes');
159
+ $caps['install_themes'] = array('core', 'themes');
160
+ $caps['update_core'] = array('core', 'general');
161
+ $caps['list_users'] = array('core', 'users');
162
+ $caps['remove_users'] = array('core', 'users');
163
+
164
+ if (version_compare($wp_version, '4.4', '<')) {
165
+ $caps['add_users'] = array('core', 'users'); // removed from WP v. 4.4.
166
+ }
167
+
168
+ $caps['promote_users'] = array('core', 'users');
169
+ $caps['edit_theme_options'] = array('core', 'themes');
170
+ $caps['delete_themes'] = array('core', 'themes');
171
+ $caps['export'] = array('core', 'general');
172
+ $caps['delete_users'] = array('core', 'users');
173
+ $caps['create_users'] = array('core', 'users');
174
+ if ($multisite) {
175
+ $caps['manage_network'] = array('core', 'multisite', 'general');
176
+ $caps['manage_sites'] = array('core', 'multisite', 'general');
177
+ $caps['create_sites'] = array('core', 'multisite', 'general');
178
+ $caps['manage_network_users'] = array('core', 'multisite', 'users');
179
+ $caps['manage_network_themes'] = array('core', 'multisite', 'themes');
180
+ $caps['manage_network_plugins'] = array('core', 'multisite', 'plugins');
181
+ $caps['manage_network_options'] = array('core', 'multisite', 'general');
182
+ }
183
+
184
+ $caps['create_posts'] = array('core', 'posts');
185
+ $caps['create_pages'] = array('core', 'pages');
186
+
187
+ $caps = apply_filters('ure_built_in_wp_caps', $caps);
188
+
189
+ return $caps;
190
+ }
191
+ // end of get_built_in_wp_caps()
192
+
193
+
194
+ private function get_custom_post_type_capabilities($post_type, $post_edit_caps, &$cpt_caps) {
195
+ foreach($post_edit_caps as $capability) {
196
+ if (!isset($post_type->cap->$capability)) {
197
+ continue;
198
+ }
199
+ $cap = $post_type->cap->$capability;
200
+ if (!isset($cpt_caps[$cap])) {
201
+ $cpt_caps[$cap] = array('custom', 'custom_post_types');
202
+ }
203
+ $cpt_caps[$cap][] = $post_type->name;
204
+ }
205
+ }
206
+ // end of get_custom_post_type_capabilities()
207
+
208
+
209
+ private function get_all_custom_post_types_capabilities() {
210
+
211
+ $post_edit_caps = $this->lib->get_edit_post_capabilities();
212
+ $post_types = get_post_types(array(), 'objects');
213
+ $_post_types = $this->lib->_get_post_types();
214
+ $built_in_pt = array('post', 'page');
215
+ if ($post_types['attachment']->cap->edit_posts=='edit_posts') {
216
+ $built_in_pt[] = 'attachment';
217
+ }
218
+ $cpt_caps = array();
219
+ foreach($post_types as $post_type) {
220
+ if (!isset($_post_types[$post_type->name])) {
221
+ continue;
222
+ }
223
+ if (in_array($post_type->name, $built_in_pt)) {
224
+ continue;
225
+ }
226
+ if (!isset($post_type->cap)) {
227
+ continue;
228
+ }
229
+ $this->get_custom_post_type_capabilities($post_type, $post_edit_caps, $cpt_caps);
230
+ }
231
+
232
+ return $cpt_caps;
233
+ }
234
+ // end of get_custom_post_types_capabilities()
235
+
236
+
237
+ private function get_woocommerce_capabilities() {
238
+
239
+ $caps = array();
240
+
241
+ return $caps;
242
+ }
243
+ // end of get_woocommerce_capabilities()
244
+
245
+
246
+ public function get_cap_groups($cap_id, $built_in_wp_caps=null) {
247
+
248
+ if (empty($built_in_wp_caps)) {
249
+ $built_in_wp_caps = $this->get_built_in_wp_caps();
250
+ }
251
+
252
+ if (isset($built_in_wp_caps[$cap_id])) {
253
+ return $built_in_wp_caps[$cap_id];
254
+ }
255
+
256
+ $wc_caps = $this->get_woocommerce_capabilities();
257
+ $groups = array();
258
+ if (isset($wc_caps[$cap_id])) {
259
+ $groups = $wc_caps[$cap_id];
260
+ }
261
+
262
+ $cpt_caps = $this->get_all_custom_post_types_capabilities();
263
+ if (isset($cpt_caps[$cap_id])) {
264
+ $groups = $cpt_caps[$cap_id];
265
+ }
266
+
267
+ if (empty($groups)) {
268
+ $groups = array('custom');
269
+ }
270
+ $groups = apply_filters('ure_custom_capability_groups', $groups, $cap_id);
271
+
272
+ return $groups;
273
+ }
274
+ // end of get_cap_groups()
275
+ }
276
+ // end of class URE_Capabilities_Groups
includes/classes/role-view.php ADDED
@@ -0,0 +1,394 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Role capabilities View class to output HTML with role capabilities
4
+ *
5
+ * @package User-Role-Editor
6
+ * @subpackage Admin
7
+ * @author Vladimir Garagulya <support@role-editor.com>
8
+ * @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
9
+ **/
10
+ class URE_Role_View extends URE_View {
11
+
12
+ private $lib = null;
13
+ public $role_default_html = '';
14
+ private $role_to_copy_html = '';
15
+ private $role_select_html = '';
16
+ private $role_delete_html = '';
17
+ private $capability_remove_html = '';
18
+
19
+
20
+ public function __construct() {
21
+
22
+ parent::__construct();
23
+ $this->lib = URE_Lib::get_instance();
24
+
25
+ }
26
+ // end of __construct()
27
+
28
+
29
+ public function role_default_prepare_html($select_width=200) {
30
+
31
+ $roles = $this->lib->get('roles');
32
+ if (!isset($roles) || !$roles) {
33
+ // get roles data from database
34
+ $roles = $this->lib->get_user_roles();
35
+ }
36
+
37
+ $caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
38
+ $show_admin_role = $this->lib->show_admin_role_allowed();
39
+ if ($select_width>0) {
40
+ $select_style = 'style="width: '. $select_width .'px"';
41
+ } else {
42
+ $select_style = '';
43
+ }
44
+ $wp_default_role = $this->lib->get('wp_default_role');
45
+ $this->role_default_html = '<select id="default_user_role" name="default_user_role" '. $select_style .'>';
46
+ foreach ($roles as $key => $value) {
47
+ $selected = $this->lib->option_selected($key, $wp_default_role);
48
+ $disabled = ($key==='administrator' && $caps_access_restrict_for_simple_admin && !is_super_admin()) ? 'disabled' : '';
49
+ if ($show_admin_role || $key != 'administrator') {
50
+ $translated_name = esc_html__($value['name'], 'user-role-editor'); // get translation from URE language file, if exists
51
+ if ($translated_name === $value['name']) { // get WordPress internal translation
52
+ $translated_name = translate_user_role($translated_name);
53
+ }
54
+ $translated_name .= ' (' . $key . ')';
55
+ $this->role_default_html .= '<option value="' . $key . '" ' . $selected .' '. $disabled .'>' . $translated_name . '</option>';
56
+ }
57
+ }
58
+ $this->role_default_html .= '</select>';
59
+
60
+ }
61
+ // end of role_default_prepare_html()
62
+
63
+
64
+ private function role_select_copy_prepare_html($select_width=200) {
65
+
66
+ global $current_user;
67
+
68
+ $key_capability = $this->lib->get_key_capability();
69
+ $user_is_ure_admin = current_user_can($key_capability);
70
+ $role_to_skip = ($user_is_ure_admin) ? '':$current_user->roles[0];
71
+
72
+ $caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
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->lib->get('current_role');
78
+ $roles = $this->lib->get_editable_user_roles();
79
+ foreach ($roles as $key => $value) {
80
+ if ($key===$role_to_skip) { // skip role of current user if he does not have full access to URE
81
+ continue;
82
+ }
83
+ $selected1 = $this->lib->option_selected($key, $current_role);
84
+ $disabled = ($key==='administrator' && $caps_access_restrict_for_simple_admin && !is_super_admin()) ? 'disabled' : '';
85
+ if ($show_admin_role || $key != 'administrator') {
86
+ $translated_name = esc_html__($value['name'], 'user-role-editor'); // get translation from URE language file, if exists
87
+ if ($translated_name === $value['name']) { // get WordPress internal translation
88
+ $translated_name = translate_user_role($translated_name);
89
+ }
90
+ $translated_name .= ' (' . $key . ')';
91
+ $this->role_select_html .= '<option value="' . $key . '" ' . $selected1 .' '. $disabled .'>' . $translated_name . '</option>';
92
+ $this->role_to_copy_html .= '<option value="' . $key .'" '. $disabled .'>' . $translated_name . '</option>';
93
+ }
94
+ }
95
+ $this->role_select_html .= '</select>';
96
+ $this->role_to_copy_html .= '</select>';
97
+ }
98
+ // end of role_select_copy_prepare_html()
99
+
100
+
101
+ private function role_delete_prepare_html() {
102
+ $roles_can_delete = $this->lib->get_roles_can_delete();
103
+ if ($roles_can_delete && count($roles_can_delete) > 0) {
104
+ $this->role_delete_html = '<select id="del_user_role" name="del_user_role" width="200" style="width: 200px">';
105
+ foreach ($roles_can_delete as $key => $value) {
106
+ $this->role_delete_html .= '<option value="' . $key . '">' . esc_html__($value, 'user-role-editor') . '</option>';
107
+ }
108
+ $this->role_delete_html .= '<option value="-1" style="color: red;">' . esc_html__('Delete All Unused Roles', 'user-role-editor') . '</option>';
109
+ $this->role_delete_html .= '</select>';
110
+ } else {
111
+ $this->role_delete_html = '';
112
+ }
113
+ }
114
+ // end of role_delete_prepare_html()
115
+
116
+
117
+ /**
118
+ * Build HTML for select drop-down list from capabilities we can remove
119
+ *
120
+ * @return string
121
+ **/
122
+ protected function caps_to_remove_prepare_html() {
123
+
124
+ $caps_to_remove = $this->lib->get_caps_to_remove();
125
+ if (!empty($caps_to_remove) && is_array($caps_to_remove) && count($caps_to_remove) > 0) {
126
+ $html = '<select id="remove_user_capability" name="remove_user_capability" width="200" style="width: 200px">';
127
+ foreach (array_keys($caps_to_remove) as $key) {
128
+ $html .= '<option value="' . $key . '">' . $key . '</option>';
129
+ }
130
+ $html .= '</select>';
131
+ } else {
132
+ $html = '';
133
+ }
134
+
135
+ $this->capability_remove_html = $html;
136
+ }
137
+ // end of caps_to_remove_prepare_html()
138
+
139
+
140
+ public function role_edit_prepare_html($select_width=200) {
141
+
142
+ $this->role_select_copy_prepare_html($select_width);
143
+ $multisite = $this->lib->get('multisite');
144
+ if ($multisite && !is_network_admin()) {
145
+ $this->role_default_prepare_html($select_width);
146
+ }
147
+ $this->role_delete_prepare_html();
148
+ $this->caps_to_remove_prepare_html();
149
+ }
150
+ // end of role_edit_prepare_html()
151
+
152
+
153
+ public function display_edit_dialogs() {
154
+ $current_role = $this->lib->get('current_role');
155
+ $current_role_name = $this->lib->get('current_role_name');
156
+ ?>
157
+ <script language="javascript" type="text/javascript">
158
+
159
+ var ure_current_role = '<?php echo $current_role; ?>';
160
+ var ure_current_role_name = '<?php echo $current_role_name; ?>';
161
+
162
+ </script>
163
+
164
+ <!-- popup dialogs markup -->
165
+ <div id="ure_add_role_dialog" class="ure-modal-dialog" style="padding: 10px;">
166
+ <form id="ure_add_role_form" name="ure_add_role_form" method="POST">
167
+ <div class="ure-label"><?php esc_html_e('Role name (ID): ', 'user-role-editor'); ?></div>
168
+ <div class="ure-input"><input type="text" name="user_role_id" id="user_role_id" size="25"/></div>
169
+ <div class="ure-label"><?php esc_html_e('Display Role Name: ', 'user-role-editor'); ?></div>
170
+ <div class="ure-input"><input type="text" name="user_role_name" id="user_role_name" size="25"/></div>
171
+ <div class="ure-label"><?php esc_html_e('Make copy of: ', 'user-role-editor'); ?></div>
172
+ <div class="ure-input"><?php echo $this->role_to_copy_html; ?></div>
173
+ </form>
174
+ </div>
175
+
176
+ <div id="ure_rename_role_dialog" class="ure-modal-dialog" style="padding: 10px;">
177
+ <form id="ure_rename_role_form" name="ure_rename_role_form" method="POST">
178
+ <div class="ure-label"><?php esc_html_e('Role name (ID): ', 'user-role-editor'); ?></div>
179
+ <div class="ure-input"><input type="text" name="ren_user_role_id" id="ren_user_role_id" size="25" disabled /></div>
180
+ <div class="ure-label"><?php esc_html_e('Display Role Name: ', 'user-role-editor'); ?></div>
181
+ <div class="ure-input"><input type="text" name="ren_user_role_name" id="ren_user_role_name" size="25"/></div>
182
+ </form>
183
+ </div>
184
+
185
+ <div id="ure_delete_role_dialog" class="ure-modal-dialog">
186
+ <div style="padding:10px;">
187
+ <div class="ure-label"><?php esc_html_e('Select Role:', 'user-role-editor');?></div>
188
+ <div class="ure-input"><?php echo $this->role_delete_html; ?></div>
189
+ </div>
190
+ </div>
191
+
192
+ <?php
193
+ if ($this->multisite && !is_network_admin()) {
194
+ ?>
195
+ <div id="ure_default_role_dialog" class="ure-modal-dialog">
196
+ <div style="padding:10px;">
197
+ <?php echo $this->role_default_html; ?>
198
+ </div>
199
+ </div>
200
+ <?php
201
+ }
202
+ ?>
203
+
204
+ <div id="ure_delete_capability_dialog" class="ure-modal-dialog">
205
+ <div style="padding:10px;">
206
+ <div class="ure-label"><?php esc_html_e('Delete:', 'user-role-editor');?></div>
207
+ <div class="ure-input"><?php echo $this->capability_remove_html; ?></div>
208
+ </div>
209
+ </div>
210
+
211
+ <div id="ure_add_capability_dialog" class="ure-modal-dialog">
212
+ <div style="padding:10px;">
213
+ <div class="ure-label"><?php esc_html_e('Capability name (ID): ', 'user-role-editor'); ?></div>
214
+ <div class="ure-input"><input type="text" name="capability_id" id="capability_id" size="25"/></div>
215
+ </div>
216
+ </div>
217
+
218
+ <?php
219
+
220
+ }
221
+ // end of output_role_edit_dialogs()
222
+
223
+
224
+ /**
225
+ * output HTML code to create URE toolbar
226
+ *
227
+ * @param string $this->current_role
228
+ * @param boolean $role_delete
229
+ * @param boolean $capability_remove
230
+ */
231
+ public function toolbar() {
232
+ $caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
233
+ if ($caps_access_restrict_for_simple_admin) {
234
+ $add_del_role_for_simple_admin = $this->lib->get_option('add_del_role_for_simple_admin', 1);
235
+ } else {
236
+ $add_del_role_for_simple_admin = 1;
237
+ }
238
+ $super_admin = is_super_admin();
239
+ $multisite = $this->lib->get('mulitisite');
240
+
241
+ ?>
242
+ <div id="ure_toolbar" >
243
+ <div id="ure_update">
244
+ <button id="ure_update_role" class="ure_toolbar_button button-primary" >Update</button>
245
+ <?php
246
+ do_action('ure_role_edit_toolbar_update');
247
+ ?>
248
+ </div>
249
+ <?php
250
+ if (!$multisite || $super_admin || $add_del_role_for_simple_admin) { // restrict single site admin
251
+ ?>
252
+ <hr />
253
+ <?php
254
+ if (current_user_can('ure_create_roles')) {
255
+ ?>
256
+ <button id="ure_add_role" class="ure_toolbar_button">Add Role</button>
257
+ <?php
258
+ }
259
+ ?>
260
+ <button id="ure_rename_role" class="ure_toolbar_button">Rename Role</button>
261
+ <?php
262
+ } // restrict single site admin
263
+ if (!$multisite || $super_admin || !$caps_access_restrict_for_simple_admin) { // restrict single site admin
264
+ if (current_user_can('ure_create_capabilities')) {
265
+ ?>
266
+ <button id="ure_add_capability" class="ure_toolbar_button">Add Capability</button>
267
+ <?php
268
+ }
269
+ } // restrict single site admin
270
+
271
+ if (!$multisite || $super_admin || $add_del_role_for_simple_admin) { // restrict single site admin
272
+ if (!empty($this->role_delete_html) && current_user_can('ure_delete_roles')) {
273
+ ?>
274
+ <button id="ure_delete_role" class="ure_toolbar_button">Delete Role</button>
275
+ <?php
276
+ }
277
+ } // restrict single site admin
278
+
279
+ if (!$multisite || $super_admin || !$caps_access_restrict_for_simple_admin) { // restrict single site admin
280
+ if (!empty($this->capability_remove_html) && current_user_can('ure_delete_capabilities')) {
281
+ ?>
282
+ <button id="ure_delete_capability" class="ure_toolbar_button">Delete Capability</button>
283
+ <?php
284
+ }
285
+ if ($multisite && !is_network_admin()) { // Show for single site for WP multisite only
286
+ ?>
287
+ <hr />
288
+ <button id="ure_default_role" class="ure_toolbar_button">Default Role</button>
289
+ <hr />
290
+ <?php
291
+ }
292
+ ?>
293
+ <div id="ure_service_tools">
294
+ <?php
295
+ do_action('ure_role_edit_toolbar_service');
296
+ if (!$this->multisite ||
297
+ (is_main_site( get_current_blog_id()) || (is_network_admin() && is_super_admin()))
298
+ ) {
299
+ if (current_user_can('ure_reset_roles')) {
300
+ ?>
301
+ <button id="ure_reset_roles_button" class="ure_toolbar_button" style="color: red;" title="Reset Roles to its original state">Reset</button>
302
+ <?php
303
+ }
304
+ }
305
+ ?>
306
+ </div>
307
+ <?php
308
+ } // restrict single site admin
309
+ ?>
310
+ </div>
311
+ <?php
312
+
313
+ }
314
+ // end of toolbar()
315
+
316
+
317
+ public function display() {
318
+
319
+ $multisite = $this->lib->get('multisite');
320
+ $active_for_network = $this->lib->get('active_for_network');
321
+ ?>
322
+
323
+ <div class="has-sidebar-content">
324
+ <div class="postbox" style="float: left; min-width:850px;">
325
+ <h3>&nbsp;<?php esc_html_e('Select Role and change its capabilities:', 'user-role-editor'); ?> <?php echo $this->role_select_html; ?></h3>
326
+ <div class="inside">
327
+ <?php
328
+ $caps_readable = $this->lib->get('caps_readable');
329
+ if ($caps_readable) {
330
+ $checked = 'checked="checked"';
331
+ } else {
332
+ $checked = '';
333
+ }
334
+ $caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
335
+ if (is_super_admin() || !$multisite || !$this->lib->is_pro() || !$caps_access_restrict_for_simple_admin) {
336
+ ?>
337
+ <input type="checkbox" name="ure_caps_readable" id="ure_caps_readable" value="1"
338
+ <?php echo $checked; ?> onclick="ure_turn_caps_readable(0);"/>
339
+ <label for="ure_caps_readable"><?php esc_html_e('Show capabilities in human readable form', 'user-role-editor'); ?></label>&nbsp;&nbsp;
340
+ <?php
341
+ $show_deprecated_caps = $this->lib->get('show_deprecated_caps');
342
+ if ($show_deprecated_caps) {
343
+ $checked = 'checked="checked"';
344
+ } else {
345
+ $checked = '';
346
+ }
347
+ ?>
348
+ <input type="checkbox" name="ure_show_deprecated_caps" id="ure_show_deprecated_caps" value="1"
349
+ <?php echo $checked; ?> onclick="ure_turn_deprecated_caps(0);"/>
350
+ <label for="ure_show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label>
351
+ <?php
352
+ }
353
+ if ($multisite && $active_for_network && !is_network_admin() && is_main_site(get_current_blog_id()) && is_super_admin()) {
354
+ $hint = esc_html__('If checked, then apply action to ALL sites of this Network');
355
+ if ($this->apply_to_all) {
356
+ $checked = 'checked="checked"';
357
+ $fontColor = 'color:#FF0000;';
358
+ } else {
359
+ $checked = '';
360
+ $fontColor = '';
361
+ }
362
+ ?>
363
+ <div style="float: right; margin-left:10px; margin-right: 20px; <?php echo $fontColor;?>" id="ure_apply_to_all_div">
364
+ <input type="checkbox" name="ure_apply_to_all" id="ure_apply_to_all" value="1"
365
+ <?php echo $checked; ?> title="<?php echo $hint;?>" onclick="ure_applyToAllOnClick(this)"/>
366
+ <label for="ure_apply_to_all" title="<?php echo $hint;?>"><?php esc_html_e('Apply to All Sites', 'user-role-editor');?></label>
367
+ </div>
368
+ <?php
369
+ }
370
+ ?>
371
+ <br /><br />
372
+ <hr />
373
+ <div style="display:table-inline; float: right; margin-right: 12px;"></div>
374
+
375
+ <?php
376
+ $this->display_caps(); ?>
377
+
378
+ <?php
379
+ $ao = $this->lib->get('role_additional_options');
380
+ $ao->show($this->current_role);
381
+ ?>
382
+ <input type="hidden" name="object" value="role" />
383
+ <?php
384
+ $this->display_box_end();
385
+ ?>
386
+ <div style="clear: left; float: left; width: 800px;"></div>
387
+ </div>
388
+ <?php
389
+
390
+ }
391
+ // end of display()
392
+
393
+ }
394
+ // end of class URE_Role_View
includes/classes/ure-lib.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  * Stuff specific for User Role Editor WordPress plugin
4
  * Author: Vladimir Garagulya
5
- * Author email: vladimir@shinephp.com
6
- * Author URI: http://shinephp.com
7
  *
8
  */
9
 
@@ -13,36 +13,29 @@
13
  */
14
  class Ure_Lib extends URE_Base_Lib {
15
 
16
- public $roles = null;
17
- public $notification = ''; // notification message to show on page
18
- public $apply_to_all = 0;
19
-
20
-
21
- protected $capabilities_to_save = null;
22
- protected $current_role = '';
23
- protected $wp_default_role = '';
24
- protected $current_role_name = '';
25
- protected $user_to_edit = '';
26
- protected $show_deprecated_caps = false;
27
- protected $caps_readable = false;
28
- protected $hide_pro_banner = false;
29
- protected $full_capabilities = false;
30
- public $ure_object = 'role'; // what to process, 'role' or 'user'
31
- public $role_default_html = '';
32
- protected $role_to_copy_html = '';
33
- protected $role_select_html = '';
34
- protected $role_delete_html = '';
35
- protected $capability_remove_html = '';
36
- protected $advert = null;
37
- protected $role_additional_options = null;
38
- protected $bbpress = null; // reference to the URE_bbPress class instance
39
 
40
- // when allow_edit_users_to_not_super_admin option is turned ON, we set this property to true
41
- // when we raise single site admin permissions up to the superadmin for the 'Add new user' new-user.php page
42
- // User_Role_Editor::allow_add_user_as_superadmin()
43
- public $raised_permissions = false;
44
-
45
- public $debug = false;
46
 
47
 
48
 
@@ -51,7 +44,7 @@ class Ure_Lib extends URE_Base_Lib {
51
  * @param string $options_id
52
  *
53
  */
54
- public function __construct($options_id) {
55
 
56
  parent::__construct($options_id);
57
  $this->debug = defined('URE_DEBUG') && (URE_DEBUG==1 || URE_DEBUG==true);
@@ -61,7 +54,7 @@ class Ure_Lib extends URE_Base_Lib {
61
  $this->upgrade();
62
  }
63
  // end of __construct()
64
-
65
 
66
  public static function get_instance($options_id = '') {
67
 
@@ -76,7 +69,7 @@ class Ure_Lib extends URE_Base_Lib {
76
  return self::$instance;
77
  }
78
  // end of get_instance()
79
-
80
 
81
  protected function upgrade() {
82
 
@@ -108,7 +101,33 @@ class Ure_Lib extends URE_Base_Lib {
108
  // end of get_ure_object();
109
 
110
 
111
- protected function get_ure_caps() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  $ure_caps = array(
114
  'ure_edit_roles' => 1,
@@ -236,7 +255,7 @@ class Ure_Lib extends URE_Base_Lib {
236
  $enable_simple_admin_for_multisite) {
237
  $key_capability = URE_KEY_CAPABILITY;
238
  } else {
239
- $key_capability = 'manage_network_users';
240
  }
241
  }
242
 
@@ -279,185 +298,58 @@ class Ure_Lib extends URE_Base_Lib {
279
 
280
  }
281
  // end of editor()
282
-
283
 
284
- protected function advertisement() {
285
 
286
- if (!$this->is_pro()) {
287
- $this->advert = new URE_Advertisement();
288
- $this->advert->display();
289
- }
290
- }
291
- // end of advertisement()
292
-
293
-
294
- protected function output_role_edit_dialogs() {
295
- ?>
296
- <script language="javascript" type="text/javascript">
297
-
298
- var ure_current_role = '<?php echo $this->current_role; ?>';
299
- var ure_current_role_name = '<?php echo $this->current_role_name; ?>';
300
-
301
- </script>
302
-
303
- <!-- popup dialogs markup -->
304
- <div id="ure_add_role_dialog" class="ure-modal-dialog" style="padding: 10px;">
305
- <form id="ure_add_role_form" name="ure_add_role_form" method="POST">
306
- <div class="ure-label"><?php esc_html_e('Role name (ID): ', 'user-role-editor'); ?></div>
307
- <div class="ure-input"><input type="text" name="user_role_id" id="user_role_id" size="25"/></div>
308
- <div class="ure-label"><?php esc_html_e('Display Role Name: ', 'user-role-editor'); ?></div>
309
- <div class="ure-input"><input type="text" name="user_role_name" id="user_role_name" size="25"/></div>
310
- <div class="ure-label"><?php esc_html_e('Make copy of: ', 'user-role-editor'); ?></div>
311
- <div class="ure-input"><?php echo $this->role_to_copy_html; ?></div>
312
- </form>
313
- </div>
314
-
315
- <div id="ure_rename_role_dialog" class="ure-modal-dialog" style="padding: 10px;">
316
- <form id="ure_rename_role_form" name="ure_rename_role_form" method="POST">
317
- <div class="ure-label"><?php esc_html_e('Role name (ID): ', 'user-role-editor'); ?></div>
318
- <div class="ure-input"><input type="text" name="ren_user_role_id" id="ren_user_role_id" size="25" disabled /></div>
319
- <div class="ure-label"><?php esc_html_e('Display Role Name: ', 'user-role-editor'); ?></div>
320
- <div class="ure-input"><input type="text" name="ren_user_role_name" id="ren_user_role_name" size="25"/></div>
321
- </form>
322
- </div>
323
-
324
- <div id="ure_delete_role_dialog" class="ure-modal-dialog">
325
- <div style="padding:10px;">
326
- <div class="ure-label"><?php esc_html_e('Select Role:', 'user-role-editor');?></div>
327
- <div class="ure-input"><?php echo $this->role_delete_html; ?></div>
328
- </div>
329
- </div>
330
-
331
- <?php
332
- if ($this->multisite && !is_network_admin()) {
333
- ?>
334
- <div id="ure_default_role_dialog" class="ure-modal-dialog">
335
- <div style="padding:10px;">
336
- <?php echo $this->role_default_html; ?>
337
- </div>
338
- </div>
339
- <?php
340
- }
341
- ?>
342
-
343
- <div id="ure_delete_capability_dialog" class="ure-modal-dialog">
344
- <div style="padding:10px;">
345
- <div class="ure-label"><?php esc_html_e('Delete:', 'user-role-editor');?></div>
346
- <div class="ure-input"><?php echo $this->capability_remove_html; ?></div>
347
- </div>
348
- </div>
349
-
350
- <div id="ure_add_capability_dialog" class="ure-modal-dialog">
351
- <div style="padding:10px;">
352
- <div class="ure-label"><?php esc_html_e('Capability name (ID): ', 'user-role-editor'); ?></div>
353
- <div class="ure-input"><input type="text" name="capability_id" id="capability_id" size="25"/></div>
354
- </div>
355
- </div>
356
-
357
- <?php
358
-
359
- }
360
- // end of output_role_edit_dialogs()
361
-
362
-
363
- protected function output_user_caps_edit_dialogs() {
364
-
365
 
366
- }
367
- // end of output_user_caps_edit_dialogs()
368
-
369
-
370
- protected function output_confirmation_dialog() {
371
- ?>
372
- <div id="ure_confirmation_dialog" class="ure-modal-dialog">
373
- <div id="ure_cd_html" style="padding:10px;"></div>
374
- </div>
375
- <?php
376
- }
377
- // end of output_confirmation_dialog()
378
-
 
 
 
 
 
 
 
379
 
380
- protected function show_editor() {
381
- $container_width = ($this->ure_object == 'user') ? 1400 : 1200;
382
-
383
- $this->show_message($this->notification);
384
- ?>
385
- <div class="wrap">
386
- <div id="ure-icon" class="icon32"><br/></div>
387
- <h1><?php _e('User Role Editor', 'user-role-editor'); ?></h1>
388
- <div id="ure_container" style="min-width: <?php echo $container_width;?>px;">
389
- <div class="ure-sidebar" >
390
- <?php
391
- $this->advertisement();
392
- ?>
 
 
 
 
 
 
 
393
  </div>
394
-
395
- <div class="has-sidebar" >
396
- <form id="ure_form" method="post" action="<?php echo URE_WP_ADMIN_URL . URE_PARENT.'?page=users-'.URE_PLUGIN_FILE;?>" >
397
- <div id="ure_form_controls">
398
- <?php
399
- wp_nonce_field('user-role-editor', 'ure_nonce');
400
- if ($this->ure_object == 'user') {
401
- require_once(URE_PLUGIN_DIR . 'includes/ure-user-edit.php');
402
- } else {
403
- $this->set_current_role();
404
- $this->role_edit_prepare_html();
405
- require_once(URE_PLUGIN_DIR . 'includes/ure-role-edit.php');
406
- }
407
- ?>
408
- <input type="hidden" name="action" value="update" />
409
- </div>
410
- </form>
411
- <?php
412
- $this->advertise_pro_version();
413
-
414
- if ($this->ure_object == 'role') {
415
- $this->output_role_edit_dialogs();
416
- } else {
417
- $this->output_user_caps_edit_dialogs();
418
- }
419
- do_action('ure_dialogs_html');
420
-
421
- $this->output_confirmation_dialog();
422
- ?>
423
- </div>
424
- </div>
425
- </div>
426
- <?php
427
-
428
  }
429
  // end of show_editor()
 
430
 
431
-
432
- // content of User Role Editor Pro advertisement slot - for direct call
433
- protected function advertise_pro_version() {
434
- if ($this->is_pro()) {
435
- return;
436
- }
437
- ?>
438
- <div id="ure_pro_advertisement" style="clear:left;display:block; float: left;">
439
- <a href="https://www.role-editor.com?utm_source=UserRoleEditor&utm_medium=banner&utm_campaign=Plugins " target="_new" >
440
- <?php
441
- if ($this->hide_pro_banner) {
442
- echo 'User Role Editor Pro: extended functionality, no advertisement - from $29.</a>';
443
- } else {
444
- ?>
445
- <img src="<?php echo URE_PLUGIN_URL;?>images/user-role-editor-pro-728x90.jpg" alt="User Role Editor Pro"
446
- title="More functionality and premium support with Pro version of User Role Editor."/>
447
- </a><br />
448
- <label for="ure_hide_pro_banner">
449
- <input type="checkbox" name="ure_hide_pro_banner" id="ure_hide_pro_banner" onclick="ure_hide_pro_banner();"/>&nbsp;Thanks, hide this banner.
450
- </label>
451
- <?php
452
- }
453
- ?>
454
- </div>
455
- <?php
456
-
457
- }
458
- // end of advertise_pro_version()
459
-
460
-
461
  // validate information about user we intend to edit
462
  protected function check_user_to_edit() {
463
 
@@ -626,14 +518,14 @@ if ($this->multisite && !is_network_admin()) {
626
  // end of process_user_request()
627
 
628
 
629
- protected function set_apply_to_all() {
630
  if (isset($_POST['ure_apply_to_all'])) {
631
  $this->apply_to_all = 1;
632
  } else {
633
  $this->apply_to_all = 0;
634
  }
635
  }
636
- // end of set_apply_to_all()
637
 
638
 
639
  public function get_default_role() {
@@ -667,7 +559,7 @@ if ($this->multisite && !is_network_admin()) {
667
  $this->ure_object = 'role';
668
  }
669
 
670
- $this->set_apply_to_all();
671
 
672
  return true;
673
  }
@@ -799,6 +691,30 @@ if ($this->multisite && !is_network_admin()) {
799
  return $this->roles;
800
  }
801
  // end of get_user_roles()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802
 
803
  /*
804
  // restores User Roles from the backup record
@@ -922,7 +838,7 @@ if ($this->multisite && !is_network_admin()) {
922
  * @global wpdb $wpdb - WP database object
923
  * @return array
924
  */
925
- protected function get_roles_can_delete() {
926
 
927
  $default_role = get_option('default_role');
928
  $standard_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
@@ -960,86 +876,9 @@ if ($this->multisite && !is_network_admin()) {
960
  * @return array
961
  */
962
  public function get_built_in_wp_caps() {
963
- $wp_version = get_bloginfo('version');
964
-
965
- $caps = array();
966
- $caps['switch_themes'] = 1;
967
- $caps['edit_themes'] = 1;
968
- $caps['activate_plugins'] = 1;
969
- $caps['edit_plugins'] = 1;
970
- $caps['edit_users'] = 1;
971
- $caps['edit_files'] = 1;
972
- $caps['manage_options'] = 1;
973
- $caps['moderate_comments'] = 1;
974
- $caps['manage_categories'] = 1;
975
- $caps['manage_links'] = 1;
976
- $caps['upload_files'] = 1;
977
- $caps['import'] = 1;
978
- $caps['unfiltered_html'] = 1;
979
- $caps['edit_posts'] = 1;
980
- $caps['edit_others_posts'] = 1;
981
- $caps['edit_published_posts'] = 1;
982
- $caps['publish_posts'] = 1;
983
- $caps['edit_pages'] = 1;
984
- $caps['read'] = 1;
985
- $caps['level_10'] = 1;
986
- $caps['level_9'] = 1;
987
- $caps['level_8'] = 1;
988
- $caps['level_7'] = 1;
989
- $caps['level_6'] = 1;
990
- $caps['level_5'] = 1;
991
- $caps['level_4'] = 1;
992
- $caps['level_3'] = 1;
993
- $caps['level_2'] = 1;
994
- $caps['level_1'] = 1;
995
- $caps['level_0'] = 1;
996
- $caps['edit_others_pages'] = 1;
997
- $caps['edit_published_pages'] = 1;
998
- $caps['publish_pages'] = 1;
999
- $caps['delete_pages'] = 1;
1000
- $caps['delete_others_pages'] = 1;
1001
- $caps['delete_published_pages'] = 1;
1002
- $caps['delete_posts'] = 1;
1003
- $caps['delete_others_posts'] = 1;
1004
- $caps['delete_published_posts'] = 1;
1005
- $caps['delete_private_posts'] = 1;
1006
- $caps['edit_private_posts'] = 1;
1007
- $caps['read_private_posts'] = 1;
1008
- $caps['delete_private_pages'] = 1;
1009
- $caps['edit_private_pages'] = 1;
1010
- $caps['read_private_pages'] = 1;
1011
- $caps['unfiltered_upload'] = 1;
1012
- $caps['edit_dashboard'] = 1;
1013
- $caps['update_plugins'] = 1;
1014
- $caps['delete_plugins'] = 1;
1015
- $caps['install_plugins'] = 1;
1016
- $caps['update_themes'] = 1;
1017
- $caps['install_themes'] = 1;
1018
- $caps['update_core'] = 1;
1019
- $caps['list_users'] = 1;
1020
- $caps['remove_users'] = 1;
1021
-
1022
- if (version_compare($wp_version, '4.4', '<')) {
1023
- $caps['add_users'] = 1; // removed from WP v. 4.4.
1024
- }
1025
 
1026
- $caps['promote_users'] = 1;
1027
- $caps['edit_theme_options'] = 1;
1028
- $caps['delete_themes'] = 1;
1029
- $caps['export'] = 1;
1030
- $caps['delete_users'] = 1;
1031
- $caps['create_users'] = 1;
1032
- if ($this->multisite) {
1033
- $caps['manage_network'] = 1;
1034
- $caps['manage_sites'] = 1;
1035
- $caps['create_sites'] = 1;
1036
- $caps['manage_network_users'] = 1;
1037
- $caps['manage_network_themes'] = 1;
1038
- $caps['manage_network_plugins'] = 1;
1039
- $caps['manage_network_options'] = 1;
1040
- }
1041
-
1042
- $caps = apply_filters('ure_built_in_wp_caps', $caps);
1043
 
1044
  return $caps;
1045
  }
@@ -1053,8 +892,7 @@ if ($this->multisite && !is_network_admin()) {
1053
  * @global wpdb $wpdb
1054
  * @return array
1055
  */
1056
- protected function get_caps_to_remove()
1057
- {
1058
  global $wp_roles;
1059
 
1060
  // build full capabilities list from all roles except Administrator
@@ -1096,60 +934,7 @@ if ($this->multisite && !is_network_admin()) {
1096
  return $caps_to_remove;
1097
  }
1098
  // end of get_caps_to_remove()
1099
-
1100
 
1101
- /**
1102
- * Build HTML for select drop-down list from capabilities we can remove
1103
- *
1104
- * @return string
1105
- */
1106
- protected function caps_to_remove_prepare_html() {
1107
-
1108
- $caps_to_remove = $this->get_caps_to_remove();
1109
- if (!empty($caps_to_remove) && is_array($caps_to_remove) && count($caps_to_remove) > 0) {
1110
- $html = '<select id="remove_user_capability" name="remove_user_capability" width="200" style="width: 200px">';
1111
- foreach (array_keys($caps_to_remove) as $key) {
1112
- $html .= '<option value="' . $key . '">' . $key . '</option>';
1113
- }
1114
- $html .= '</select>';
1115
- } else {
1116
- $html = '';
1117
- }
1118
-
1119
- $this->capability_remove_html = $html;
1120
- }
1121
- // end of caps_to_remove_prepare_html()
1122
-
1123
-
1124
- /**
1125
- * returns array of deprecated capabilities
1126
- *
1127
- * @return array
1128
- */
1129
- protected function get_deprecated_caps()
1130
- {
1131
-
1132
- $dep_caps = array(
1133
- 'level_0' => 0,
1134
- 'level_1' => 0,
1135
- 'level_2' => 0,
1136
- 'level_3' => 0,
1137
- 'level_4' => 0,
1138
- 'level_5' => 0,
1139
- 'level_6' => 0,
1140
- 'level_7' => 0,
1141
- 'level_8' => 0,
1142
- 'level_9' => 0,
1143
- 'level_10' => 0,
1144
- 'edit_files' => 0);
1145
- if ($this->multisite) {
1146
- $dep_caps['unfiltered_html'] = 0;
1147
- }
1148
-
1149
- return $dep_caps;
1150
- }
1151
- // end of get_deprecated_caps()
1152
-
1153
 
1154
  /**
1155
  * Return true if $capability is included to the list of capabilities allowed for the single site administrator
@@ -1157,7 +942,7 @@ if ($this->multisite && !is_network_admin()) {
1157
  * @param boolean $ignore_super_admin - if
1158
  * @return boolean
1159
  */
1160
- protected function block_cap_for_single_admin($capability, $ignore_super_admin=false) {
1161
 
1162
  if (!$this->is_pro()) { // this functionality is for the Pro version only.
1163
  return false;
@@ -1185,233 +970,6 @@ if ($this->multisite && !is_network_admin()) {
1185
  // end of block_cap_for_single_admin()
1186
 
1187
 
1188
- /**
1189
- * output HTML-code for capabilities list
1190
- * @param boolean $core - if true, then show WordPress core capabilities, else custom (plugins and themes created)
1191
- * @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
1192
- * @param boolean $edit_mode - if false, capabilities checkboxes are shown as disable - readonly mode
1193
- */
1194
- protected function show_capabilities($core = true, $for_role = true, $edit_mode=true) {
1195
-
1196
- if ($this->multisite && !is_super_admin()) {
1197
- $help_links_enabled = $this->get_option('enable_help_links_for_simple_admin_ms', 1);
1198
- } else {
1199
- $help_links_enabled = true;
1200
- }
1201
-
1202
- $onclick_for_admin = '';
1203
- if (!( $this->multisite && is_super_admin() )) { // do not limit SuperAdmin for multi-site
1204
- if ($core && 'administrator' == $this->current_role) {
1205
- $onclick_for_admin = 'onclick="ure_turn_it_back(this)"';
1206
- }
1207
- }
1208
-
1209
- if ($core) {
1210
- $quant = count($this->get_built_in_wp_caps());
1211
- $deprecated_caps = $this->get_deprecated_caps();
1212
- } else {
1213
- $quant = count($this->full_capabilities) - count($this->get_built_in_wp_caps());
1214
- $deprecated_caps = array();
1215
- }
1216
- $quant_in_column = (int) $quant / 3;
1217
- $printed_quant = 0;
1218
- $printed_total = 0;
1219
- foreach ($this->full_capabilities as $capability) {
1220
- if ($core) {
1221
- if (!$capability['wp_core']) { // show WP built-in capabilities 1st
1222
- continue;
1223
- }
1224
- } else {
1225
- if ($capability['wp_core']) { // show plugins and themes added capabilities
1226
- continue;
1227
- }
1228
- }
1229
- if (!$this->show_deprecated_caps && isset($deprecated_caps[$capability['inner']])) {
1230
- $hidden_class = 'class="hidden"';
1231
- } else {
1232
- $hidden_class = '';
1233
- }
1234
- if (isset($deprecated_caps[$capability['inner']])) {
1235
- $label_style = 'style="color:#BBBBBB;"';
1236
- } else {
1237
- $label_style = '';
1238
- }
1239
- if ($this->multisite && $this->block_cap_for_single_admin($capability['inner'], true)) {
1240
- if (is_super_admin()) {
1241
- if (!is_network_admin()) {
1242
- $label_style = 'style="color: red;"';
1243
- }
1244
- } else {
1245
- $hidden_class = 'class="hidden"';
1246
- }
1247
- }
1248
- $checked = '';
1249
- $disabled = '';
1250
- if ($for_role) {
1251
- if (isset($this->roles[$this->current_role]['capabilities'][$capability['inner']]) &&
1252
- !empty($this->roles[$this->current_role]['capabilities'][$capability['inner']])) {
1253
- $checked = 'checked="checked"';
1254
- }
1255
- } else {
1256
- if (empty($edit_mode)) {
1257
- $disabled = 'disabled="disabled"';
1258
- } else {
1259
- $disabled = '';
1260
- }
1261
- if ($this->user_can($capability['inner'])) {
1262
- $checked = 'checked="checked"';
1263
- if (!isset($this->user_to_edit->caps[$capability['inner']])) {
1264
- $disabled = 'disabled="disabled"';
1265
- }
1266
- }
1267
- }
1268
- $cap_id = str_replace(' ', URE_SPACE_REPLACER, $capability['inner']);
1269
- echo '<div id="ure_div_cap_'. $cap_id.'" '. $hidden_class .'><input type="checkbox" name="' . $cap_id . '" id="' .
1270
- $cap_id . '" value="' . $capability['inner'] .'" '. $checked . ' ' . $disabled . ' ' . $onclick_for_admin . '>';
1271
- if (empty($hidden_class)) {
1272
- if ($this->caps_readable) {
1273
- $cap_ind = 'human';
1274
- $cap_ind_alt = 'inner';
1275
- } else {
1276
- $cap_ind = 'inner';
1277
- $cap_ind_alt = 'human';
1278
- }
1279
- $help_link = $help_links_enabled ? $this->capability_help_link($capability['inner']) : '';
1280
- echo '<label for="' . $cap_id . '" title="' . $capability[$cap_ind_alt] . '" ' . $label_style . ' > ' .
1281
- $capability[$cap_ind] . '</label> ' . $help_link . '</div>';
1282
- $printed_quant++;
1283
- $printed_total++;
1284
- if ($printed_quant>=$quant_in_column) {
1285
- $printed_quant = 0;
1286
- echo '</td>';
1287
- if ($printed_total<$quant) {
1288
- echo '<td style="vertical-align:top;">';
1289
- }
1290
- }
1291
- } else { // if (empty($hidden_class
1292
- echo '</div>';
1293
- } // if (empty($hidden_class
1294
- }
1295
- }
1296
- // end of show_capabilities()
1297
-
1298
-
1299
- /**
1300
- * output HTML code to create URE toolbar
1301
- *
1302
- * @param string $this->current_role
1303
- * @param boolean $role_delete
1304
- * @param boolean $capability_remove
1305
- */
1306
- protected function toolbar($role_delete = false, $capability_remove = false) {
1307
- $caps_access_restrict_for_simple_admin = $this->get_option('caps_access_restrict_for_simple_admin', 0);
1308
- if ($caps_access_restrict_for_simple_admin) {
1309
- $add_del_role_for_simple_admin = $this->get_option('add_del_role_for_simple_admin', 1);
1310
- } else {
1311
- $add_del_role_for_simple_admin = 1;
1312
- }
1313
- $super_admin = is_super_admin();
1314
-
1315
- ?>
1316
- <div id="ure_toolbar" >
1317
- <button id="ure_select_all" class="ure_toolbar_button">Select All</button>
1318
- <?php
1319
- if ('administrator' != $this->current_role) {
1320
- ?>
1321
- <button id="ure_unselect_all" class="ure_toolbar_button">Unselect All</button>
1322
- <button id="ure_reverse_selection" class="ure_toolbar_button">Reverse</button>
1323
- <?php
1324
- }
1325
- if ($this->ure_object == 'role') {
1326
- ?>
1327
- <hr />
1328
- <div id="ure_update">
1329
- <button id="ure_update_role" class="ure_toolbar_button button-primary" >Update</button>
1330
- <?php
1331
- do_action('ure_role_edit_toolbar_update');
1332
- ?>
1333
- </div>
1334
- <?php
1335
- if (!$this->multisite || $super_admin || $add_del_role_for_simple_admin) { // restrict single site admin
1336
- ?>
1337
- <hr />
1338
- <?php
1339
- if (current_user_can('ure_create_roles')) {
1340
- ?>
1341
- <button id="ure_add_role" class="ure_toolbar_button">Add Role</button>
1342
- <?php
1343
- }
1344
- ?>
1345
- <button id="ure_rename_role" class="ure_toolbar_button">Rename Role</button>
1346
- <?php
1347
- } // restrict single site admin
1348
- if (!$this->multisite || $super_admin || !$caps_access_restrict_for_simple_admin) { // restrict single site admin
1349
- if (current_user_can('ure_create_capabilities')) {
1350
- ?>
1351
- <button id="ure_add_capability" class="ure_toolbar_button">Add Capability</button>
1352
- <?php
1353
- }
1354
- } // restrict single site admin
1355
-
1356
- if (!$this->multisite || $super_admin || $add_del_role_for_simple_admin) { // restrict single site admin
1357
- if (!empty($role_delete) && current_user_can('ure_delete_roles')) {
1358
- ?>
1359
- <button id="ure_delete_role" class="ure_toolbar_button">Delete Role</button>
1360
- <?php
1361
- }
1362
- } // restrict single site admin
1363
-
1364
- if (!$this->multisite || $super_admin || !$caps_access_restrict_for_simple_admin) { // restrict single site admin
1365
- if ($capability_remove && current_user_can('ure_delete_capabilities')) {
1366
- ?>
1367
- <button id="ure_delete_capability" class="ure_toolbar_button">Delete Capability</button>
1368
- <?php
1369
- }
1370
- if ($this->multisite && !is_network_admin()) { // Show for single site for WP multisite only
1371
- ?>
1372
- <hr />
1373
- <button id="ure_default_role" class="ure_toolbar_button">Default Role</button>
1374
- <hr />
1375
- <?php
1376
- }
1377
- ?>
1378
- <div id="ure_service_tools">
1379
- <?php
1380
- do_action('ure_role_edit_toolbar_service');
1381
- if (!$this->multisite ||
1382
- (is_main_site( get_current_blog_id()) || (is_network_admin() && is_super_admin()))
1383
- ) {
1384
- if (current_user_can('ure_reset_roles')) {
1385
- ?>
1386
- <button id="ure_reset_roles_button" class="ure_toolbar_button" style="color: red;" title="Reset Roles to its original state">Reset</button>
1387
- <?php
1388
- }
1389
- }
1390
- ?>
1391
- </div>
1392
- <?php
1393
- } // restrict single site admin
1394
- } else {
1395
- ?>
1396
-
1397
- <hr />
1398
- <div id="ure_update_user">
1399
- <button id="ure_update_role" class="ure_toolbar_button button-primary">Update</button>
1400
- <?php
1401
- do_action('ure_user_edit_toolbar_update');
1402
- ?>
1403
-
1404
- </div>
1405
- <?php
1406
- }
1407
- ?>
1408
-
1409
- </div>
1410
- <?php
1411
- }
1412
- // end of toolbar()
1413
-
1414
-
1415
  /**
1416
  * return link to the capability according its name in $capability parameter
1417
  *
@@ -1662,19 +1220,20 @@ if ($this->multisite && !is_network_admin()) {
1662
  * @return array
1663
  */
1664
  public function _get_post_types() {
1665
- $all_post_types = get_post_types();
1666
- $internal_post_types = get_post_types(array('public'=>false, '_builtin'=>true));
1667
- $post_types = array_diff($all_post_types, $internal_post_types);
 
 
 
 
1668
 
1669
  return $post_types;
1670
  }
1671
- // end of get_post_types()
1672
 
1673
 
1674
- protected function add_custom_post_type_caps() {
1675
-
1676
- global $wp_roles;
1677
-
1678
  $capabilities = array(
1679
  'create_posts',
1680
  'edit_posts',
@@ -1689,6 +1248,16 @@ if ($this->multisite && !is_network_admin()) {
1689
  'delete_others_posts'
1690
  );
1691
 
 
 
 
 
 
 
 
 
 
 
1692
  $post_types = get_post_types(array(), 'objects');
1693
  $_post_types = $this->_get_post_types();
1694
  // do not forget attachment post type as it may use the own capabilities set
@@ -1705,16 +1274,17 @@ if ($this->multisite && !is_network_admin()) {
1705
  continue;
1706
  }
1707
  foreach($capabilities as $capability) {
1708
- if (isset($post_type->cap->$capability)) {
1709
- $cap_to_check = $post_type->cap->$capability;
1710
- $this->add_capability_to_full_caps_list($cap_to_check);
1711
- if (!$this->multisite &&
1712
- isset($wp_roles->role_objects['administrator']) &&
1713
- !isset($wp_roles->role_objects['administrator']->capabilities[$cap_to_check])) {
1714
- // admin should be capable to edit any posts
1715
- $wp_roles->role_objects['administrator']->add_cap($cap_to_check, true);
1716
- }
1717
- }
 
1718
  }
1719
  }
1720
 
@@ -1738,8 +1308,11 @@ if ($this->multisite && !is_network_admin()) {
1738
  * Add capabilities for URE permissions system in case some were excluded from Administrator role
1739
  *
1740
  */
1741
- protected function add_ure_caps() {
1742
-
 
 
 
1743
  $ure_caps = $this->get_ure_caps();
1744
  foreach(array_keys($ure_caps) as $cap) {
1745
  $this->add_capability_to_full_caps_list($cap);
@@ -1838,10 +1411,21 @@ if ($this->multisite && !is_network_admin()) {
1838
 
1839
 
1840
  protected function last_check_before_update() {
 
 
1841
  if (empty($this->roles) || !is_array($this->roles) || count($this->roles)==0) { // Nothing to save - something goes wrong - stop ...
1842
  return false;
1843
  }
1844
 
 
 
 
 
 
 
 
 
 
1845
  return true;
1846
  }
1847
  // end of last_check_before_update()
@@ -2606,34 +2190,6 @@ if ($this->multisite && !is_network_admin()) {
2606
  }
2607
  // end of roles_text()
2608
 
2609
-
2610
- /**
2611
- * display opening part of the HTML box with title and CSS style
2612
- *
2613
- * @param string $title
2614
- * @param string $style
2615
- */
2616
- protected function display_box_start($title, $style = '') {
2617
- ?>
2618
- <div class="postbox" style="float: left; <?php echo $style; ?>">
2619
- <h3 style="cursor:default;"><span><?php echo $title ?></span></h3>
2620
- <div class="inside">
2621
- <?php
2622
- }
2623
- // end of display_box_start()
2624
-
2625
-
2626
- /**
2627
- * close HTML box opened by display_box_start() call
2628
- */
2629
- function display_box_end() {
2630
- ?>
2631
- </div>
2632
- </div>
2633
- <?php
2634
- }
2635
- // end of display_box_end()
2636
-
2637
 
2638
  public function about() {
2639
  if ($this->is_pro()) {
@@ -2677,125 +2233,18 @@ if ($this->multisite && !is_network_admin()) {
2677
  // end of set_current_role()
2678
 
2679
 
2680
- protected function show_admin_role_allowed() {
2681
  $show_admin_role = $this->get_option('show_admin_role', 0);
2682
  $show_admin_role = ((defined('URE_SHOW_ADMIN_ROLE') && URE_SHOW_ADMIN_ROLE==1) || $show_admin_role==1) && $this->user_is_admin();
2683
 
2684
  return $show_admin_role;
2685
  }
2686
  // end of show_admin_role()
2687
-
2688
-
2689
- public function role_default_prepare_html($select_width=200) {
2690
-
2691
- if (!isset($this->roles) || !$this->roles) {
2692
- // get roles data from database
2693
- $this->roles = $this->get_user_roles();
2694
- }
2695
-
2696
- $caps_access_restrict_for_simple_admin = $this->get_option('caps_access_restrict_for_simple_admin', 0);
2697
- $show_admin_role = $this->show_admin_role_allowed();
2698
- if ($select_width>0) {
2699
- $select_style = 'style="width: '. $select_width .'px"';
2700
- } else {
2701
- $select_style = '';
2702
- }
2703
- $this->role_default_html = '<select id="default_user_role" name="default_user_role" '. $select_style .'>';
2704
- foreach ($this->roles as $key => $value) {
2705
- $selected = $this->option_selected($key, $this->wp_default_role);
2706
- $disabled = ($key==='administrator' && $caps_access_restrict_for_simple_admin && !is_super_admin()) ? 'disabled' : '';
2707
- if ($show_admin_role || $key != 'administrator') {
2708
- $translated_name = esc_html__($value['name'], 'user-role-editor'); // get translation from URE language file, if exists
2709
- if ($translated_name === $value['name']) { // get WordPress internal translation
2710
- $translated_name = translate_user_role($translated_name);
2711
- }
2712
- $translated_name .= ' (' . $key . ')';
2713
- $this->role_default_html .= '<option value="' . $key . '" ' . $selected .' '. $disabled .'>' . $translated_name . '</option>';
2714
- }
2715
- }
2716
- $this->role_default_html .= '</select>';
2717
-
2718
- }
2719
- // end of role_default_prepare_html()
2720
-
2721
-
2722
- private function role_delete_prepare_html() {
2723
- $roles_can_delete = $this->get_roles_can_delete();
2724
- if ($roles_can_delete && count($roles_can_delete) > 0) {
2725
- $this->role_delete_html = '<select id="del_user_role" name="del_user_role" width="200" style="width: 200px">';
2726
- foreach ($roles_can_delete as $key => $value) {
2727
- $this->role_delete_html .= '<option value="' . $key . '">' . esc_html__($value, 'user-role-editor') . '</option>';
2728
- }
2729
- $this->role_delete_html .= '<option value="-1" style="color: red;">' . esc_html__('Delete All Unused Roles', 'user-role-editor') . '</option>';
2730
- $this->role_delete_html .= '</select>';
2731
- } else {
2732
- $this->role_delete_html = '';
2733
- }
2734
- }
2735
- // end of role_delete_prepare_html()
2736
-
2737
-
2738
- private function role_select_copy_prepare_html($select_width=200) {
2739
- $caps_access_restrict_for_simple_admin = $this->get_option('caps_access_restrict_for_simple_admin', 0);
2740
- $show_admin_role = $this->show_admin_role_allowed();
2741
- $this->role_to_copy_html = '<select id="user_role_copy_from" name="user_role_copy_from" style="width: '. $select_width .'px">
2742
- <option value="none" selected="selected">' . esc_html__('None', 'user-role-editor') . '</option>';
2743
- $this->role_select_html = '<select id="user_role" name="user_role" onchange="ure_role_change(this.value);">';
2744
- foreach ($this->roles as $key => $value) {
2745
- $selected1 = $this->option_selected($key, $this->current_role);
2746
- $disabled = ($key==='administrator' && $caps_access_restrict_for_simple_admin && !is_super_admin()) ? 'disabled' : '';
2747
- if ($show_admin_role || $key != 'administrator') {
2748
- $translated_name = esc_html__($value['name'], 'user-role-editor'); // get translation from URE language file, if exists
2749
- if ($translated_name === $value['name']) { // get WordPress internal translation
2750
- $translated_name = translate_user_role($translated_name);
2751
- }
2752
- $translated_name .= ' (' . $key . ')';
2753
- $this->role_select_html .= '<option value="' . $key . '" ' . $selected1 .' '. $disabled .'>' . $translated_name . '</option>';
2754
- $this->role_to_copy_html .= '<option value="' . $key .'" '. $disabled .'>' . $translated_name . '</option>';
2755
- }
2756
- }
2757
- $this->role_select_html .= '</select>';
2758
- $this->role_to_copy_html .= '</select>';
2759
- }
2760
- // end of role_select_copy_prepare_html()
2761
-
2762
-
2763
- public function role_edit_prepare_html($select_width=200) {
2764
 
2765
- $this->role_select_copy_prepare_html($select_width);
2766
- if ($this->multisite && !is_network_admin()) {
2767
- $this->role_default_prepare_html($select_width);
2768
- }
2769
- $this->role_delete_prepare_html();
2770
- $this->caps_to_remove_prepare_html();
2771
- }
2772
- // end of role_edit_prepare_html()
2773
-
2774
-
2775
- public function user_primary_role_dropdown_list($user_roles) {
2776
- ?>
2777
- <select name="primary_role" id="primary_role">
2778
- <?php
2779
- // Compare user role against currently editable roles
2780
- $user_roles = array_intersect( array_values( $user_roles ), array_keys( get_editable_roles() ) );
2781
- $user_primary_role = array_shift( $user_roles );
2782
-
2783
- // print the full list of roles with the primary one selected.
2784
- wp_dropdown_roles($user_primary_role);
2785
-
2786
- // print the 'no role' option. Make it selected if the user has no role yet.
2787
- $selected = ( empty($user_primary_role) ) ? 'selected="selected"' : '';
2788
- echo '<option value="" '. $selected.'>' . esc_html__('&mdash; No role for this site &mdash;') . '</option>';
2789
- ?>
2790
- </select>
2791
- <?php
2792
- }
2793
- // end of user_primary_role_dropdown_list()
2794
-
2795
 
2796
  // returns true if $user has $capability assigned through the roles or directly
2797
  // returns true if user has role with name equal $capability
2798
- protected function user_can($capability) {
2799
 
2800
  if (isset($this->user_to_edit->caps[$capability])) {
2801
  return true;
@@ -2872,7 +2321,7 @@ if ($this->multisite && !is_network_admin()) {
2872
  // end of get_current_role()
2873
 
2874
 
2875
- protected function get_edit_user_caps_mode() {
2876
  if ($this->multisite && is_super_admin()) {
2877
  return 1;
2878
  }
@@ -2926,5 +2375,17 @@ if ($this->multisite && !is_network_admin()) {
2926
  }
2927
  // end of get_assign_role()
2928
 
 
 
 
 
 
 
 
 
 
 
 
 
2929
  }
2930
  // end of URE_Lib class
2
  /*
3
  * Stuff specific for User Role Editor WordPress plugin
4
  * Author: Vladimir Garagulya
5
+ * Author email: support@role-editor.com
6
+ * Author URI: https://www.role-editor.com
7
  *
8
  */
9
 
13
  */
14
  class Ure_Lib extends URE_Base_Lib {
15
 
16
+ protected $roles = null;
17
+ protected $notification = ''; // notification message to show on page
18
+ protected $apply_to_all = 0;
19
+ protected $current_role = '';
20
+ protected $capabilities_to_save = null;
21
+ protected $wp_default_role = '';
22
+ protected $current_role_name = '';
23
+ protected $user_to_edit = '';
24
+ protected $show_deprecated_caps = false;
25
+ protected $caps_readable = false;
26
+ protected $hide_pro_banner = false;
27
+ protected $full_capabilities = false;
28
+ protected $ure_object = 'role'; // what to process, 'role' or 'user'
29
+ protected $advert = null;
30
+ protected $role_additional_options = null;
31
+ protected $bbpress = null; // reference to the URE_bbPress class instance
32
+
33
+ // when allow_edit_users_to_not_super_admin option is turned ON, we set this property to true
34
+ // when we raise single site admin permissions up to the superadmin for the 'Add new user' new-user.php page
35
+ // User_Role_Editor::allow_add_user_as_superadmin()
36
+ protected $raised_permissions = false;
 
 
37
 
38
+ protected $debug = false;
 
 
 
 
 
39
 
40
 
41
 
44
  * @param string $options_id
45
  *
46
  */
47
+ protected function __construct($options_id) {
48
 
49
  parent::__construct($options_id);
50
  $this->debug = defined('URE_DEBUG') && (URE_DEBUG==1 || URE_DEBUG==true);
54
  $this->upgrade();
55
  }
56
  // end of __construct()
57
+
58
 
59
  public static function get_instance($options_id = '') {
60
 
69
  return self::$instance;
70
  }
71
  // end of get_instance()
72
+
73
 
74
  protected function upgrade() {
75
 
101
  // end of get_ure_object();
102
 
103
 
104
+
105
+ public function set_notification($value) {
106
+
107
+ $this->notification = $value;
108
+
109
+ }
110
+ // end of esc_html()
111
+
112
+
113
+ public function set_apply_to_all($value) {
114
+
115
+
116
+ $this->apply_to_all = !empty($value) ? 1 : 0;
117
+
118
+ }
119
+ // end of set_apply_to_all()
120
+
121
+
122
+ public function set_raised_permissions($value) {
123
+
124
+ $this->raised_permissions = !empty($value) ? true : false;
125
+
126
+ }
127
+ // end of set_raised_permissions()
128
+
129
+
130
+ public function get_ure_caps() {
131
 
132
  $ure_caps = array(
133
  'ure_edit_roles' => 1,
255
  $enable_simple_admin_for_multisite) {
256
  $key_capability = URE_KEY_CAPABILITY;
257
  } else {
258
+ $key_capability = 'manage_network_plugins';
259
  }
260
  }
261
 
298
 
299
  }
300
  // end of editor()
 
301
 
 
302
 
303
+ protected function show_editor() {
304
+ $container_width = ($this->ure_object == 'user') ? 1400 : 1200;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
 
306
+ $this->show_message($this->notification);
307
+ if ($this->ure_object == 'user') {
308
+ $view = new URE_User_View();
309
+ } else {
310
+ $this->set_current_role();
311
+ $view = new URE_Role_View();
312
+ $view->role_edit_prepare_html();
313
+ }
314
+ ?>
315
+ <div class="wrap">
316
+ <div id="ure-icon" class="icon32"><br/></div>
317
+ <h1><?php _e('User Role Editor', 'user-role-editor'); ?></h1>
318
+ <div id="ure_container" style="min-width: <?php echo $container_width; ?>px;">
319
+ <div class="ure-sidebar" >
320
+ <?php
321
+ if (!$this->is_pro()) {
322
+ $view->advertise_commercials();
323
+ }
324
+ ?>
325
+ </div>
326
 
327
+ <div class="has-sidebar" >
328
+ <form id="ure_form" method="post" action="<?php echo URE_WP_ADMIN_URL . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE; ?>" >
329
+ <div id="ure_form_controls">
330
+ <?php
331
+ $view->display();
332
+ wp_nonce_field('user-role-editor', 'ure_nonce');
333
+ ?>
334
+ <input type="hidden" name="action" value="update" />
335
+ </div>
336
+ </form>
337
+ <?php
338
+ if (!$this->is_pro()) {
339
+ $view->advertise_pro();
340
+ }
341
+ $view->display_edit_dialogs();
342
+ do_action('ure_dialogs_html');
343
+ $view->output_confirmation_dialog();
344
+ ?>
345
+ </div>
346
+ </div>
347
  </div>
348
+ <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
349
  }
350
  // end of show_editor()
351
+
352
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
353
  // validate information about user we intend to edit
354
  protected function check_user_to_edit() {
355
 
518
  // end of process_user_request()
519
 
520
 
521
+ protected function set_apply_to_all_from_post() {
522
  if (isset($_POST['ure_apply_to_all'])) {
523
  $this->apply_to_all = 1;
524
  } else {
525
  $this->apply_to_all = 0;
526
  }
527
  }
528
+ // end of set_apply_to_all_from_post()
529
 
530
 
531
  public function get_default_role() {
559
  $this->ure_object = 'role';
560
  }
561
 
562
+ $this->set_apply_to_all_from_post();
563
 
564
  return true;
565
  }
691
  return $this->roles;
692
  }
693
  // end of get_user_roles()
694
+
695
+
696
+ /**
697
+ * Respect 'editable_roles' filter, when needed
698
+ * @return array
699
+ */
700
+ public function get_editable_user_roles() {
701
+
702
+ if (empty($this->roles)) {
703
+ $this->get_user_roles();
704
+ }
705
+ if ($this->bbpress!==null) {
706
+ remove_filter('editable_roles', 'bbp_filter_blog_editable_roles');
707
+ }
708
+ $roles = apply_filters('editable_roles', $this->roles);
709
+ if ($this->bbpress!==null) {
710
+ add_filter('editable_roles', 'bbp_filter_blog_editable_roles');
711
+ }
712
+
713
+ return $roles;
714
+
715
+ }
716
+ // end of get_editable_user_roles()
717
+
718
 
719
  /*
720
  // restores User Roles from the backup record
838
  * @global wpdb $wpdb - WP database object
839
  * @return array
840
  */
841
+ public function get_roles_can_delete() {
842
 
843
  $default_role = get_option('default_role');
844
  $standard_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
876
  * @return array
877
  */
878
  public function get_built_in_wp_caps() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
879
 
880
+ $caps_groups = URE_Capabilities_Groups_Manager::get_instance();
881
+ $caps = $caps_groups->get_built_in_wp_caps();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
882
 
883
  return $caps;
884
  }
892
  * @global wpdb $wpdb
893
  * @return array
894
  */
895
+ public function get_caps_to_remove() {
 
896
  global $wp_roles;
897
 
898
  // build full capabilities list from all roles except Administrator
934
  return $caps_to_remove;
935
  }
936
  // end of get_caps_to_remove()
 
937
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
938
 
939
  /**
940
  * Return true if $capability is included to the list of capabilities allowed for the single site administrator
942
  * @param boolean $ignore_super_admin - if
943
  * @return boolean
944
  */
945
+ public function block_cap_for_single_admin($capability, $ignore_super_admin=false) {
946
 
947
  if (!$this->is_pro()) { // this functionality is for the Pro version only.
948
  return false;
970
  // end of block_cap_for_single_admin()
971
 
972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
973
  /**
974
  * return link to the capability according its name in $capability parameter
975
  *
1220
  * @return array
1221
  */
1222
  public function _get_post_types() {
1223
+ $post_types = get_transient('ure_public_post_types');
1224
+ if (empty($post_types)) {
1225
+ $all_post_types = get_post_types();
1226
+ $internal_post_types = get_post_types(array('public'=>false, '_builtin'=>true));
1227
+ $post_types = array_diff($all_post_types, $internal_post_types);
1228
+ set_transient('ure_public_post_types', $post_types, 30);
1229
+ }
1230
 
1231
  return $post_types;
1232
  }
1233
+ // end of _get_post_types()
1234
 
1235
 
1236
+ public function get_edit_post_capabilities() {
 
 
 
1237
  $capabilities = array(
1238
  'create_posts',
1239
  'edit_posts',
1248
  'delete_others_posts'
1249
  );
1250
 
1251
+ return $capabilities;
1252
+ }
1253
+ // end of get_edit_post_capabilities();
1254
+
1255
+
1256
+ protected function add_custom_post_type_caps() {
1257
+
1258
+ global $wp_roles;
1259
+
1260
+ $capabilities = $this->get_edit_post_capabilities();
1261
  $post_types = get_post_types(array(), 'objects');
1262
  $_post_types = $this->_get_post_types();
1263
  // do not forget attachment post type as it may use the own capabilities set
1274
  continue;
1275
  }
1276
  foreach($capabilities as $capability) {
1277
+ if (!isset($post_type->cap->$capability)) {
1278
+ continue;
1279
+ }
1280
+ $cap_to_check = $post_type->cap->$capability;
1281
+ $this->add_capability_to_full_caps_list($cap_to_check);
1282
+ if (!$this->multisite &&
1283
+ isset($wp_roles->role_objects['administrator']) &&
1284
+ !isset($wp_roles->role_objects['administrator']->capabilities[$cap_to_check])) {
1285
+ // admin should be capable to edit any posts
1286
+ $wp_roles->role_objects['administrator']->add_cap($cap_to_check, true);
1287
+ }
1288
  }
1289
  }
1290
 
1308
  * Add capabilities for URE permissions system in case some were excluded from Administrator role
1309
  *
1310
  */
1311
+ protected function add_ure_caps() {
1312
+ $key_capability = $this->get_key_capability();
1313
+ if (!current_user_can($key_capability)) {
1314
+ return;
1315
+ }
1316
  $ure_caps = $this->get_ure_caps();
1317
  foreach(array_keys($ure_caps) as $cap) {
1318
  $this->add_capability_to_full_caps_list($cap);
1411
 
1412
 
1413
  protected function last_check_before_update() {
1414
+ global $current_user;
1415
+
1416
  if (empty($this->roles) || !is_array($this->roles) || count($this->roles)==0) { // Nothing to save - something goes wrong - stop ...
1417
  return false;
1418
  }
1419
 
1420
+ $key_capability = $this->get_key_capability();
1421
+ $user_is_ure_admin = current_user_can($key_capability);
1422
+ if (!$user_is_ure_admin) {
1423
+ if (in_array($this->current_role, $current_user->roles)) {
1424
+ // do not allow to a user update his own role if he does not have full access to the User Role Editor
1425
+ return false;
1426
+ }
1427
+ }
1428
+
1429
  return true;
1430
  }
1431
  // end of last_check_before_update()
2190
  }
2191
  // end of roles_text()
2192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2193
 
2194
  public function about() {
2195
  if ($this->is_pro()) {
2233
  // end of set_current_role()
2234
 
2235
 
2236
+ public function show_admin_role_allowed() {
2237
  $show_admin_role = $this->get_option('show_admin_role', 0);
2238
  $show_admin_role = ((defined('URE_SHOW_ADMIN_ROLE') && URE_SHOW_ADMIN_ROLE==1) || $show_admin_role==1) && $this->user_is_admin();
2239
 
2240
  return $show_admin_role;
2241
  }
2242
  // end of show_admin_role()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2244
 
2245
  // returns true if $user has $capability assigned through the roles or directly
2246
  // returns true if user has role with name equal $capability
2247
+ public function user_can($capability) {
2248
 
2249
  if (isset($this->user_to_edit->caps[$capability])) {
2250
  return true;
2321
  // end of get_current_role()
2322
 
2323
 
2324
+ public function get_edit_user_caps_mode() {
2325
  if ($this->multisite && is_super_admin()) {
2326
  return 1;
2327
  }
2375
  }
2376
  // end of get_assign_role()
2377
 
2378
+
2379
+ public function get_ure_page_url() {
2380
+ $page_url = URE_WP_ADMIN_URL . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE;
2381
+ $object = $this->get_request_var('object', 'get');
2382
+ $user_id = $this->get_request_var('user_id', 'get', 'int');
2383
+ if ($object=='user' && $user_id>0) {
2384
+ $page_url .= '&object=user&user_id='. $user_id;
2385
+ }
2386
+
2387
+ return $page_url;
2388
+ }
2389
+ // end of get_ure_page_url()
2390
  }
2391
  // end of URE_Lib class
includes/classes/user-other-roles.php CHANGED
@@ -33,7 +33,8 @@ class URE_User_Other_Roles {
33
  add_action( 'user_new_form', array($this, 'user_new_form'), 10, 1 );
34
  add_action( 'profile_update', array($this, 'update'), 10 );
35
  }
36
- if ($this->lib->multisite) {
 
37
  add_action( 'wpmu_activate_user', array($this, 'add_other_roles'), 10, 1 );
38
  }
39
  add_action( 'user_register', array($this, 'add_other_roles'), 10, 1 );
33
  add_action( 'user_new_form', array($this, 'user_new_form'), 10, 1 );
34
  add_action( 'profile_update', array($this, 'update'), 10 );
35
  }
36
+ $multisite = $this->lib->get('multisite');
37
+ if ($multisite) {
38
  add_action( 'wpmu_activate_user', array($this, 'add_other_roles'), 10, 1 );
39
  }
40
  add_action( 'user_register', array($this, 'add_other_roles'), 10, 1 );
includes/classes/user-role-editor.php CHANGED
@@ -20,6 +20,8 @@ class User_Role_Editor {
20
  // URE's key capability
21
  public $key_capability = 'not allowed';
22
 
 
 
23
  // URE pages hook suffixes
24
  protected $ure_hook_suffixes = null;
25
 
@@ -35,10 +37,13 @@ class User_Role_Editor {
35
  $this->user_other_roles = new URE_User_Other_Roles();
36
 
37
  if ($this->lib->is_pro()) {
38
- $this->ure_hook_suffixes = array('settings_page_settings-user-role-editor-pro', 'users_page_users-user-role-editor-pro');
 
39
  } else {
40
- $this->ure_hook_suffixes = array('settings_page_settings-user-role-editor', 'users_page_users-user-role-editor');
 
41
  }
 
42
 
43
  // activation action
44
  register_activation_hook(URE_PLUGIN_FULL_PATH, array($this, 'setup'));
@@ -60,7 +65,8 @@ class User_Role_Editor {
60
 
61
 
62
  private function set_hooks() {
63
- if ($this->lib->multisite) {
 
64
  // new blog may be registered not at admin back-end only but automatically after new user registration, e.g.
65
  // Gravity Forms User Registration Addon does
66
  add_action( 'wpmu_new_blog', array($this, 'duplicate_roles_for_new_blog'), 10, 2);
@@ -81,7 +87,7 @@ class User_Role_Editor {
81
  // add own submenu
82
  add_action('admin_menu', array($this, 'plugin_menu'));
83
 
84
- if ($this->lib->multisite) {
85
  // add own submenu
86
  add_action('network_admin_menu', array($this, 'network_plugin_menu'));
87
  }
@@ -130,7 +136,8 @@ class User_Role_Editor {
130
  add_action('user_row_actions', array($this, 'user_row'), 10, 2);
131
  add_filter('all_plugins', array($this, 'exclude_from_plugins_list'));
132
 
133
- if ($this->lib->multisite) {
 
134
  $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
135
  if ($allow_edit_users_to_not_super_admin) {
136
  add_filter('map_meta_cap', array($this, 'restore_users_edit_caps'), 1, 4);
@@ -167,7 +174,7 @@ class User_Role_Editor {
167
 
168
  global $pagenow, $current_user;
169
 
170
- $this->lib->raised_permissions = false;
171
 
172
  if ($pagenow!=='user-new.php') {
173
  return $site_admins;
@@ -183,7 +190,7 @@ class User_Role_Editor {
183
  }
184
 
185
  if (!in_array($current_user->user_login, $site_admins)) {
186
- $this->lib->raised_permissions = true;
187
  $site_admins[] = $current_user->user_login;
188
  }
189
 
@@ -394,14 +401,14 @@ class User_Role_Editor {
394
  * @param type array $plugins plugins list
395
  * @return type array $plugins updated plugins list
396
  */
397
- public function exclude_from_plugins_list($plugins) {
398
-
399
  // if multi-site, then allow plugin activation for network superadmins and, if that's specially defined, - for single site administrators too
400
- if ($this->lib->multisite) {
401
  if (is_super_admin() || $this->lib->user_is_admin()) {
402
  return $plugins;
403
  }
404
- } else {
405
  // is_super_admin() defines superadmin for not multisite as user who can 'delete_users' which I don't like.
406
  // So let's check if user has 'administrator' role better.
407
  if (current_user_can('administrator') || $this->lib->user_is_admin()) {
@@ -410,14 +417,14 @@ class User_Role_Editor {
410
  }
411
 
412
  // exclude URE from plugins list
413
- $key = basename(URE_PLUGIN_DIR) .'/'. URE_PLUGIN_FILE;
414
- unset($plugins[$key]);
415
 
416
  return $plugins;
417
  }
418
  // end of exclude_from_plugins_list()
 
419
 
420
-
421
  /**
422
  * Load plugin translation files - linked to the 'plugins_loaded' action
423
  *
@@ -459,8 +466,9 @@ class User_Role_Editor {
459
 
460
 
461
  public function settings_screen_configure() {
 
462
  $settings_page_hook = $this->settings_page_hook;
463
- if (is_multisite()) {
464
  $settings_page_hook .= '-network';
465
  }
466
  $screen = get_current_screen();
@@ -474,7 +482,7 @@ class User_Role_Editor {
474
  'title' => esc_html__('General', 'user-role-editor'),
475
  'content' => $screen_help->get_settings_help('general')
476
  ));
477
- if ($this->lib->is_pro() || !$this->lib->multisite) {
478
  $screen->add_help_tab( array(
479
  'id' => 'additional_modules',
480
  'title' => esc_html__('Additional Modules', 'user-role-editor'),
@@ -486,7 +494,7 @@ class User_Role_Editor {
486
  'title' => esc_html__('Default Roles', 'user-role-editor'),
487
  'content' => $screen_help->get_settings_help('default_roles')
488
  ));
489
- if ($this->lib->multisite) {
490
  $screen->add_help_tab( array(
491
  'id' => 'multisite',
492
  'title' => esc_html__('Multisite', 'user-role-editor'),
@@ -505,13 +513,15 @@ class User_Role_Editor {
505
  'users.php',
506
  $translated_title,
507
  $translated_title,
508
- $this->key_capability,
509
  'users-' . URE_PLUGIN_FILE,
510
  array($this, 'edit_roles'));
511
  add_action("admin_print_styles-$ure_page", array($this, 'admin_css_action'));
512
  }
513
 
514
- if ( !$this->lib->multisite || ($this->lib->multisite && !$this->lib->active_for_network) ) {
 
 
515
  $settings_capability = $this->lib->get_settings_capability();
516
  $this->settings_page_hook = add_options_page(
517
  $translated_title,
@@ -601,8 +611,8 @@ class User_Role_Editor {
601
  * Update Additional Modules Options tab
602
  */
603
  protected function update_addons_options() {
604
-
605
- if (!$this->lib->multisite) {
606
  $count_users_without_role = $this->lib->get_request_var('count_users_without_role', 'checkbox');
607
  $this->lib->put_option('count_users_without_role', $count_users_without_role);
608
  }
@@ -643,7 +653,8 @@ class User_Role_Editor {
643
 
644
 
645
  protected function update_multisite_options() {
646
- if (!$this->lib->multisite) {
 
647
  return;
648
  }
649
 
@@ -691,28 +702,29 @@ class User_Role_Editor {
691
  $show_deprecated_caps = $this->lib->get_option('ure_show_deprecated_caps', 0);
692
  $confirm_role_update = $this->lib->get_option('ure_confirm_role_update', 1);
693
  $edit_user_caps = $this->lib->get_option('edit_user_caps', 1);
694
-
695
- if ($this->lib->multisite) {
696
  $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
697
  } else {
698
  $count_users_without_role = $this->lib->get_option('count_users_without_role', 0);
699
  }
700
 
701
  $this->lib->get_default_role();
702
- //$this->lib->editor_init1();
703
- $this->lib->role_default_prepare_html(0);
704
 
705
  $ure_tab_idx = $this->lib->get_request_var('ure_tab_idx', 'int');
706
 
707
  do_action('ure_settings_load');
708
 
709
- if ($this->lib->multisite && is_network_admin()) {
710
  $link = 'settings.php';
711
  } else {
712
  $link = 'options-general.php';
713
  }
714
 
715
- $license_key_only = $this->lib->multisite && is_network_admin() && !$this->lib->active_for_network;
 
716
 
717
 
718
  require_once(URE_PLUGIN_DIR . 'includes/settings-template.php');
@@ -722,7 +734,8 @@ class User_Role_Editor {
722
 
723
  public function admin_css_action() {
724
 
725
- wp_enqueue_style('wp-jquery-ui-dialog');
 
726
  if (stripos($_SERVER['REQUEST_URI'], 'settings-user-role-editor')!==false) {
727
  wp_enqueue_style('ure-jquery-ui-tabs', URE_PLUGIN_URL . 'css/jquery-ui-1.10.4.custom.min.css', array(), false, 'screen');
728
  }
@@ -734,7 +747,7 @@ class User_Role_Editor {
734
  // call roles editor page
735
  public function edit_roles() {
736
 
737
- if (!current_user_can($this->key_capability)) {
738
  wp_die(esc_html__('Insufficient permissions to work with User Role Editor', 'user-role-editor'));
739
  }
740
 
@@ -756,30 +769,21 @@ class User_Role_Editor {
756
 
757
  }
758
  // end of setup()
759
-
760
-
761
- /**
762
- * Load plugin javascript stuff
763
- *
764
- * @param string $hook_suffix
765
- */
766
- public function admin_load_js($hook_suffix) {
767
-
768
- URE_Known_JS_CSS_Compatibility_Issues::fix($hook_suffix, $this->ure_hook_suffixes);
769
-
770
- if (!in_array($hook_suffix, $this->ure_hook_suffixes)) {
771
- return;
772
- }
773
 
774
- $confirm_role_update = $this->lib->get_option('ure_confirm_role_update', 1);
 
775
 
776
  wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core', 'jquery-ui-button', 'jquery'));
 
777
  wp_enqueue_script('jquery-ui-tabs', false, array('jquery-ui-core', 'jquery'));
778
  wp_register_script('ure-js', plugins_url('/js/ure-js.js', URE_PLUGIN_FULL_PATH));
779
  wp_enqueue_script('ure-js');
780
  wp_localize_script('ure-js', 'ure_data', array(
781
  'wp_nonce' => wp_create_nonce('user-role-editor'),
782
- 'page_url' => URE_WP_ADMIN_URL . URE_PARENT . '?page=users-' . URE_PLUGIN_FILE,
783
  'is_multisite' => is_multisite() ? 1 : 0,
784
  'confirm_role_update' => $confirm_role_update ? 1 : 0,
785
  'confirm_title' => esc_html__('Confirm', 'user-role-editor'),
@@ -816,7 +820,34 @@ class User_Role_Editor {
816
  ));
817
 
818
  // load additional JS stuff for Pro version, if exists
819
- do_action('ure_load_js');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
820
 
821
  }
822
  // end of admin_load_js()
20
  // URE's key capability
21
  public $key_capability = 'not allowed';
22
 
23
+ protected $main_page_hook_suffix = null;
24
+ protected $settings_hook_suffix = null;
25
  // URE pages hook suffixes
26
  protected $ure_hook_suffixes = null;
27
 
37
  $this->user_other_roles = new URE_User_Other_Roles();
38
 
39
  if ($this->lib->is_pro()) {
40
+ $this->main_page_hook_suffix = 'users_page_users-user-role-editor-pro';
41
+ $this->settings_hook_suffix = 'settings_page_settings-user-role-editor-pro';
42
  } else {
43
+ $this->main_page_hook_suffix = 'users_page_users-user-role-editor';
44
+ $this->settings_hook_suffix = 'settings_page_settings-user-role-editor';
45
  }
46
+ $this->ure_hook_suffixes = array($this->settings_hook_suffix, $this->main_page_hook_suffix);
47
 
48
  // activation action
49
  register_activation_hook(URE_PLUGIN_FULL_PATH, array($this, 'setup'));
65
 
66
 
67
  private function set_hooks() {
68
+ $multisite = $this->lib->get('multisite');
69
+ if ($multisite) {
70
  // new blog may be registered not at admin back-end only but automatically after new user registration, e.g.
71
  // Gravity Forms User Registration Addon does
72
  add_action( 'wpmu_new_blog', array($this, 'duplicate_roles_for_new_blog'), 10, 2);
87
  // add own submenu
88
  add_action('admin_menu', array($this, 'plugin_menu'));
89
 
90
+ if ($multisite) {
91
  // add own submenu
92
  add_action('network_admin_menu', array($this, 'network_plugin_menu'));
93
  }
136
  add_action('user_row_actions', array($this, 'user_row'), 10, 2);
137
  add_filter('all_plugins', array($this, 'exclude_from_plugins_list'));
138
 
139
+ $multisite = $this->lib->get('multisite');
140
+ if ($multisite) {
141
  $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
142
  if ($allow_edit_users_to_not_super_admin) {
143
  add_filter('map_meta_cap', array($this, 'restore_users_edit_caps'), 1, 4);
174
 
175
  global $pagenow, $current_user;
176
 
177
+ $this->lib->set_raised_permissions(false);
178
 
179
  if ($pagenow!=='user-new.php') {
180
  return $site_admins;
190
  }
191
 
192
  if (!in_array($current_user->user_login, $site_admins)) {
193
+ $this->lib->set_raised_permissions(true);
194
  $site_admins[] = $current_user->user_login;
195
  }
196
 
401
  * @param type array $plugins plugins list
402
  * @return type array $plugins updated plugins list
403
  */
404
+ public function exclude_from_plugins_list($plugins) {
405
+ $multisite = $this->lib->get('multisite');
406
  // if multi-site, then allow plugin activation for network superadmins and, if that's specially defined, - for single site administrators too
407
+ if ($multisite) {
408
  if (is_super_admin() || $this->lib->user_is_admin()) {
409
  return $plugins;
410
  }
411
+ } else {
412
  // is_super_admin() defines superadmin for not multisite as user who can 'delete_users' which I don't like.
413
  // So let's check if user has 'administrator' role better.
414
  if (current_user_can('administrator') || $this->lib->user_is_admin()) {
417
  }
418
 
419
  // exclude URE from plugins list
420
+ $key = basename(URE_PLUGIN_DIR) . '/' . URE_PLUGIN_FILE;
421
+ unset($plugins[$key]);
422
 
423
  return $plugins;
424
  }
425
  // end of exclude_from_plugins_list()
426
+
427
 
 
428
  /**
429
  * Load plugin translation files - linked to the 'plugins_loaded' action
430
  *
466
 
467
 
468
  public function settings_screen_configure() {
469
+ $multisite = $this->lib->get('multisite');
470
  $settings_page_hook = $this->settings_page_hook;
471
+ if ($multisite) {
472
  $settings_page_hook .= '-network';
473
  }
474
  $screen = get_current_screen();
482
  'title' => esc_html__('General', 'user-role-editor'),
483
  'content' => $screen_help->get_settings_help('general')
484
  ));
485
+ if ($this->lib->is_pro() || !$multisite) {
486
  $screen->add_help_tab( array(
487
  'id' => 'additional_modules',
488
  'title' => esc_html__('Additional Modules', 'user-role-editor'),
494
  'title' => esc_html__('Default Roles', 'user-role-editor'),
495
  'content' => $screen_help->get_settings_help('default_roles')
496
  ));
497
+ if ($multisite) {
498
  $screen->add_help_tab( array(
499
  'id' => 'multisite',
500
  'title' => esc_html__('Multisite', 'user-role-editor'),
513
  'users.php',
514
  $translated_title,
515
  $translated_title,
516
+ 'ure_edit_roles',
517
  'users-' . URE_PLUGIN_FILE,
518
  array($this, 'edit_roles'));
519
  add_action("admin_print_styles-$ure_page", array($this, 'admin_css_action'));
520
  }
521
 
522
+ $multisite = $this->lib->get('multisite');
523
+ $active_for_network = $this->lib->get('active_for_network');
524
+ if ( !$multisite || ($multisite && !$active_for_network) ) {
525
  $settings_capability = $this->lib->get_settings_capability();
526
  $this->settings_page_hook = add_options_page(
527
  $translated_title,
611
  * Update Additional Modules Options tab
612
  */
613
  protected function update_addons_options() {
614
+ $multisite = $this->lib->get('multisite');
615
+ if (!$multisite) {
616
  $count_users_without_role = $this->lib->get_request_var('count_users_without_role', 'checkbox');
617
  $this->lib->put_option('count_users_without_role', $count_users_without_role);
618
  }
653
 
654
 
655
  protected function update_multisite_options() {
656
+ $multisite = $this->lib->get('multisite');
657
+ if (!$multisite) {
658
  return;
659
  }
660
 
702
  $show_deprecated_caps = $this->lib->get_option('ure_show_deprecated_caps', 0);
703
  $confirm_role_update = $this->lib->get_option('ure_confirm_role_update', 1);
704
  $edit_user_caps = $this->lib->get_option('edit_user_caps', 1);
705
+ $multisite = $this->lib->get('multisite');
706
+ if ($multisite) {
707
  $allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
708
  } else {
709
  $count_users_without_role = $this->lib->get_option('count_users_without_role', 0);
710
  }
711
 
712
  $this->lib->get_default_role();
713
+ $view = new URE_Role_View();
714
+ $view->role_default_prepare_html(0);
715
 
716
  $ure_tab_idx = $this->lib->get_request_var('ure_tab_idx', 'int');
717
 
718
  do_action('ure_settings_load');
719
 
720
+ if ($multisite && is_network_admin()) {
721
  $link = 'settings.php';
722
  } else {
723
  $link = 'options-general.php';
724
  }
725
 
726
+ $active_for_network = $this->lib->get('active_for_network');
727
+ $license_key_only = $multisite && is_network_admin() && !$active_for_network;
728
 
729
 
730
  require_once(URE_PLUGIN_DIR . 'includes/settings-template.php');
734
 
735
  public function admin_css_action() {
736
 
737
+ wp_enqueue_style('wp-jquery-ui-dialog');
738
+ wp_enqueue_style('wp-jquery-ui-selectable');
739
  if (stripos($_SERVER['REQUEST_URI'], 'settings-user-role-editor')!==false) {
740
  wp_enqueue_style('ure-jquery-ui-tabs', URE_PLUGIN_URL . 'css/jquery-ui-1.10.4.custom.min.css', array(), false, 'screen');
741
  }
747
  // call roles editor page
748
  public function edit_roles() {
749
 
750
+ if (!current_user_can('ure_edit_roles')) {
751
  wp_die(esc_html__('Insufficient permissions to work with User Role Editor', 'user-role-editor'));
752
  }
753
 
769
 
770
  }
771
  // end of setup()
772
+
773
+
774
+ protected function load_main_page_js() {
 
 
 
 
 
 
 
 
 
 
 
775
 
776
+ $confirm_role_update = $this->lib->get_option('ure_confirm_role_update', 1);
777
+ $page_url = $this->lib->get_ure_page_url();
778
 
779
  wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core', 'jquery-ui-button', 'jquery'));
780
+ wp_enqueue_script('jquery-ui-selectable', false, array('jquery-ui-core', 'jquery'));
781
  wp_enqueue_script('jquery-ui-tabs', false, array('jquery-ui-core', 'jquery'));
782
  wp_register_script('ure-js', plugins_url('/js/ure-js.js', URE_PLUGIN_FULL_PATH));
783
  wp_enqueue_script('ure-js');
784
  wp_localize_script('ure-js', 'ure_data', array(
785
  'wp_nonce' => wp_create_nonce('user-role-editor'),
786
+ 'page_url' => $page_url,
787
  'is_multisite' => is_multisite() ? 1 : 0,
788
  'confirm_role_update' => $confirm_role_update ? 1 : 0,
789
  'confirm_title' => esc_html__('Confirm', 'user-role-editor'),
820
  ));
821
 
822
  // load additional JS stuff for Pro version, if exists
823
+ do_action('ure_load_js');
824
+
825
+ }
826
+ // end of load_main_page_js()
827
+
828
+
829
+ protected function load_settings_js() {
830
+
831
+ wp_enqueue_script('jquery-ui-tabs', false, array('jquery-ui-core', 'jquery'));
832
+
833
+ }
834
+ // end of load_settings_js()
835
+
836
+
837
+ /**
838
+ * Load plugin javascript stuff
839
+ *
840
+ * @param string $hook_suffix
841
+ */
842
+ public function admin_load_js($hook_suffix) {
843
+
844
+ URE_Known_JS_CSS_Compatibility_Issues::fix($hook_suffix, $this->ure_hook_suffixes);
845
+
846
+ if ($hook_suffix==$this->main_page_hook_suffix) {
847
+ $this->load_main_page_js();
848
+ } elseif($hook_suffix==$this->settings_hook_suffix) {
849
+ $this->load_settings_js();
850
+ }
851
 
852
  }
853
  // end of admin_load_js()
includes/classes/user-view.php ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User capabilities View class to output HTML with capabilities assigne to the user
4
+ *
5
+ * @package User-Role-Editor
6
+ * @subpackage Admin
7
+ * @author Vladimir Garagulya <support@role-editor.com>
8
+ * @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
9
+ **/
10
+ class URE_User_View extends URE_View {
11
+
12
+ private $lib = null;
13
+ private $user_to_edit = null;
14
+
15
+
16
+ public function __construct() {
17
+
18
+ parent::__construct();
19
+ $this->lib = URE_Lib::get_instance();
20
+ $this->user_to_edit = $this->lib->get('user_to_edit');
21
+
22
+ }
23
+ // end of __construct()
24
+
25
+
26
+ public function display_edit_dialogs() {
27
+
28
+ }
29
+ // end of display_edit_dialogs()
30
+
31
+
32
+ /**
33
+ * output HTML code to create URE toolbar
34
+ *
35
+ * @param boolean $role_delete
36
+ * @param boolean $capability_remove
37
+ */
38
+ public function toolbar() {
39
+ ?>
40
+ <div id="ure_toolbar" >
41
+ <div id="ure_update">
42
+ <button id="ure_update_role" class="ure_toolbar_button button-primary">Update</button>
43
+ <?php
44
+ do_action('ure_user_edit_toolbar_update');
45
+ ?>
46
+ </div>
47
+
48
+ </div>
49
+ <?php
50
+ }
51
+ // end of toolbar()
52
+
53
+
54
+ private function get_user_info() {
55
+ $switch_to_user = '';
56
+ if (!is_multisite() || current_user_can('manage_network_users')) {
57
+ $anchor_start = '<a href="' . wp_nonce_url("user-edit.php?user_id={$this->user_to_edit->ID}", "ure_user_{$this->user_to_edit->ID}") . '" >';
58
+ $anchor_end = '</a>';
59
+ if (class_exists('user_switching') && current_user_can('switch_to_user', $this->user_to_edit->ID)) {
60
+ $switch_to_user_link = user_switching::switch_to_url($this->user_to_edit);
61
+ $switch_to_user = '<a href="' . esc_url($switch_to_user_link) . '">' . esc_html__('Switch&nbsp;To', 'user-switching') . '</a>';
62
+ }
63
+ } else {
64
+ $anchor_start = '';
65
+ $anchor_end = '';
66
+ }
67
+ $user_info = ' <span style="font-weight: bold;">' . $anchor_start . $this->user_to_edit->user_login;
68
+ if ($this->user_to_edit->display_name !== $this->user_to_edit->user_login) {
69
+ $user_info .= ' (' . $this->user_to_edit->display_name . ')';
70
+ }
71
+ $user_info .= $anchor_end . '</span>';
72
+ if (is_multisite() && is_super_admin($this->user_to_edit->ID)) {
73
+ $user_info .= ' <span style="font-weight: bold; color:red;">' . esc_html__('Network Super Admin', 'user-role-editor') . '</span>';
74
+ }
75
+
76
+ if (!empty($switch_to_user)) {
77
+ $user_info .= '&nbsp;&nbsp;&nbsp;&nbsp;' . $switch_to_user;
78
+ }
79
+
80
+ return $user_info;
81
+ }
82
+ // end of build_user_info()
83
+
84
+
85
+ private function show_primary_role_dropdown_list($user_roles) {
86
+ ?>
87
+ <select name="primary_role" id="primary_role">
88
+ <?php
89
+ // Compare user role against currently editable roles
90
+ $user_roles = array_intersect( array_values( $user_roles ), array_keys( get_editable_roles() ) );
91
+ $user_primary_role = array_shift( $user_roles );
92
+
93
+ // print the full list of roles with the primary one selected.
94
+ wp_dropdown_roles($user_primary_role);
95
+
96
+ // print the 'no role' option. Make it selected if the user has no role yet.
97
+ $selected = ( empty($user_primary_role) ) ? 'selected="selected"' : '';
98
+ echo '<option value="" '. $selected.'>' . esc_html__('&mdash; No role for this site &mdash;') . '</option>';
99
+ ?>
100
+ </select>
101
+ <?php
102
+ }
103
+ // end of show_primary_role_dropdown_list()
104
+
105
+
106
+ private function show_secondary_roles() {
107
+ $show_admin_role = $this->lib->show_admin_role_allowed();
108
+ $values = array_values($this->user_to_edit->roles);
109
+ $primary_role = array_shift($values); // get 1st element from roles array
110
+ $roles = $this->lib->get('roles');
111
+ foreach ($roles as $role_id => $role) {
112
+ if (($show_admin_role || $role_id != 'administrator') && ($role_id !== $primary_role)) {
113
+ if ($this->lib->user_can($role_id)) {
114
+ $checked = 'checked="checked"';
115
+ } else {
116
+ $checked = '';
117
+ }
118
+ echo '<label for="wp_role_' . $role_id . '"><input type="checkbox" id="wp_role_' . $role_id .
119
+ '" name="wp_role_' . $role_id . '" value="' . $role_id . '"' . $checked . ' />&nbsp;' .
120
+ esc_html__($role['name'], 'user-role-editor') . '</label><br />';
121
+ }
122
+ }
123
+ }
124
+ // end of show_secondary_roles()
125
+
126
+
127
+ public function display() {
128
+ $edit_user_caps_mode = $this->lib->get_edit_user_caps_mode();
129
+ $caps_access_restrict_for_simple_admin = $this->lib->get_option('caps_access_restrict_for_simple_admin', 0);
130
+ $user_info = $this->get_user_info();
131
+ ?>
132
+
133
+ <div class="has-sidebar-content">
134
+ <?php
135
+ $this->display_box_start(esc_html__('Change capabilities for user', 'user-role-editor'). $user_info, 'min-width:1000px;');
136
+
137
+ ?>
138
+ <table cellpadding="0" cellspacing="0" style="width: 100%;">
139
+ <tr>
140
+ <td>&nbsp;</td>
141
+ <td style="padding-left: 10px; padding-bottom: 5px;">
142
+ <?php
143
+ if (is_super_admin() || !$this->multisite || !class_exists('User_Role_Editor_Pro') || !$caps_access_restrict_for_simple_admin) {
144
+ if ($this->caps_readable) {
145
+ $checked = 'checked="checked"';
146
+ } else {
147
+ $checked = '';
148
+ }
149
+ ?>
150
+ <input type="checkbox" name="ure_caps_readable" id="ure_caps_readable" value="1"
151
+ <?php echo $checked; ?> onclick="ure_turn_caps_readable(<?php echo $this->user_to_edit->ID; ?>);" />
152
+ <label for="ure_caps_readable"><?php esc_html_e('Show capabilities in human readable form', 'user-role-editor'); ?></label>&nbsp;&nbsp;&nbsp;
153
+ <?php
154
+ if ($this->show_deprecated_caps) {
155
+ $checked = 'checked="checked"';
156
+ } else {
157
+ $checked = '';
158
+ }
159
+ ?>
160
+ <input type="checkbox" name="ure_show_deprecated_caps" id="ure_show_deprecated_caps" value="1"
161
+ <?php echo $checked; ?> onclick="ure_turn_deprecated_caps(<?php echo $this->user_to_edit->ID; ?>);"/>
162
+ <label for="ure_show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label>
163
+ <?php
164
+ }
165
+ ?>
166
+ </td>
167
+ </tr>
168
+ <tr>
169
+ <td class="ure-user-roles">
170
+ <div style="margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('Primary Role:', 'user-role-editor'); ?></div>
171
+ <?php
172
+ $this->show_primary_role_dropdown_list($this->user_to_edit->roles);
173
+
174
+ if (function_exists('bbp_filter_blog_editable_roles') ) { // bbPress plugin is active
175
+ ?>
176
+ <div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('bbPress Role:', 'user-role-editor'); ?></div>
177
+ <?php
178
+ $dynamic_roles = bbp_get_dynamic_roles();
179
+ $bbp_user_role = bbp_get_user_role($this->user_to_edit->ID);
180
+ if (!empty($bbp_user_role)) {
181
+ echo $dynamic_roles[$bbp_user_role]['name'];
182
+ }
183
+ }
184
+ ?>
185
+ <div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('Other Roles:', 'user-role-editor'); ?></div>
186
+ <?php
187
+ $this->show_secondary_roles();
188
+ ?>
189
+ </td>
190
+ <td style="padding-left: 5px; padding-top: 5px; border-top: 1px solid #ccc;">
191
+ <?php $this->display_caps(false, $edit_user_caps_mode ); ?>
192
+ </td>
193
+ </tr>
194
+ </table>
195
+ <input type="hidden" name="object" value="user" />
196
+ <input type="hidden" name="user_id" value="<?php echo $this->user_to_edit->ID; ?>" />
197
+ <?php
198
+ $this->display_box_end();
199
+ ?>
200
+
201
+ </div>
202
+ <?php
203
+ }
204
+ // end of display()
205
+
206
+
207
+ }
208
+ // end of class URE_User_View
includes/classes/view.php ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * View class to output any HTML used at User Role Editor
4
+ *
5
+ * @package User-Role-Editor
6
+ * @subpackage Admin
7
+ * @author Vladimir Garagulya <support@role-editor.com>
8
+ * @copyright Copyright (c) 2010 - 2016, Vladimir Garagulya
9
+ **/
10
+ class URE_View {
11
+
12
+ private $lib = null;
13
+
14
+
15
+ public function __construct() {
16
+
17
+ $this->lib = URE_Lib::get_instance();
18
+
19
+ }
20
+ // end of __construct()
21
+
22
+
23
+ /**
24
+ * display opening part of the HTML box with title and CSS style
25
+ *
26
+ * @param string $title
27
+ * @param string $style
28
+ */
29
+ public function display_box_start($title, $style = '') {
30
+ ?>
31
+ <div class="postbox" style="float: left; <?php echo $style; ?>">
32
+ <h3 style="cursor:default;"><span><?php echo $title ?></span></h3>
33
+ <div class="inside">
34
+ <?php
35
+ }
36
+ // end of display_box_start()
37
+
38
+
39
+ /**
40
+ * close HTML box opened by display_box_start() call
41
+ */
42
+ public function display_box_end() {
43
+ ?>
44
+ </div>
45
+ </div>
46
+ <?php
47
+ }
48
+ // end of display_box_end()
49
+
50
+
51
+ public function show_caps_groups() {
52
+ $groups = URE_Capabilities_Groups_Manager::get_instance();
53
+ $groups_list = $groups->get_groups_tree();
54
+ $output = '<ul id="ure_caps_groups_list">'. PHP_EOL;
55
+ foreach($groups_list as $group_id=>$group) {
56
+ $spacer = $group_id=='all' ? '' : str_repeat('&nbsp;', $group['level']*2) .'- ';
57
+ $output .= '<li id="ure_caps_group_'. $group_id .'">'. $spacer . $group['caption'] .'</li>'. PHP_EOL;
58
+ }
59
+ $output .= '</ul>'. PHP_EOL;
60
+
61
+ echo $output;
62
+ }
63
+ // end of show_caps_groups()
64
+
65
+
66
+ private function deprecated_show_and_color($cap_id, $builtin_wp_caps, &$label_style, &$hidden_class) {
67
+
68
+ if (isset($builtin_wp_caps[$cap_id])) {
69
+ if (in_array('deprecated', $builtin_wp_caps[$cap_id])) {
70
+ $show_deprecated_caps = $this->lib->get('show_deprecated_caps');
71
+ if (!$show_deprecated_caps) {
72
+ $hidden_class = 'hidden';
73
+ }
74
+ $label_style = 'style="color:#BBBBBB;"';
75
+ }
76
+ }
77
+
78
+ }
79
+ // end of deprecated_show_and_color()
80
+
81
+
82
+ private function blocked_for_single_admin_style($cap_id, &$label_style) {
83
+
84
+ $blocked = false;
85
+ $multisite = $this->lib->get('multisite');
86
+ if ($multisite && $this->lib->block_cap_for_single_admin($cap_id, true)) {
87
+ if (is_super_admin()) {
88
+ if (!is_network_admin()) {
89
+ $label_style = 'style="color: red;"';
90
+ }
91
+ } else {
92
+ $blocked = true;
93
+ }
94
+ }
95
+
96
+ return $blocked;
97
+ }
98
+ // end of blocked_for_single_admin_style()
99
+
100
+
101
+ /**
102
+ * output HTML-code for capabilities list
103
+ * @param boolean $for_role - if true, it is role capabilities list, else - user specific capabilities list
104
+ * @param boolean $edit_mode - if false, capabilities checkboxes are shown as disable - readonly mode
105
+ */
106
+ public function show_capabilities($for_role = true, $edit_mode=true) {
107
+
108
+ $onclick_for_admin = '';
109
+ $multisite = $this->lib->get('multisite');
110
+ $current_role = $this->lib->get('current_role');
111
+ if (!($multisite && is_super_admin())) { // do not limit SuperAdmin for multi-site
112
+ if ('administrator'==$current_role) {
113
+ $onclick_for_admin = 'onclick="ure_turn_it_back(this)"';
114
+ }
115
+ }
116
+ $user_to_edit = $this->lib->get('user_to_edit');
117
+ $roles = $this->lib->get('roles');
118
+ $full_capabilities = $this->lib->get('full_capabilities');
119
+ $built_in_wp_caps = $this->lib->get_built_in_wp_caps();
120
+ $caps_readable = $this->lib->get('caps_readable');
121
+ $caps_groups_manager = URE_Capabilities_Groups_Manager::get_instance();
122
+
123
+ $key_capability = $this->lib->get_key_capability();
124
+ $user_is_ure_admin = current_user_can($key_capability);
125
+ $ure_caps = $this->lib->get_ure_caps();
126
+
127
+ $output = '';
128
+ foreach ($full_capabilities as $capability) {
129
+ $cap_id = $capability['inner'];
130
+ if (!$user_is_ure_admin) {
131
+ if (isset($ure_caps[$cap_id]) ||
132
+ ($this->multisite && $cap_id=='manage_network_plugins')) {
133
+ // exclude URE caps if user does not have full access to URE
134
+ continue;
135
+ }
136
+ }
137
+ $label_style = '';
138
+ $hidden_class = '';
139
+
140
+ $this->deprecated_show_and_color($cap_id, $built_in_wp_caps, $label_style, $hidden_class);
141
+ $blocked = $this->blocked_for_single_admin_style($cap_id, $label_style);
142
+ $classes = array('ure-cap-div');
143
+ if ($blocked) {
144
+ $classes[] = 'blocked';
145
+ $hidden_class = 'hidden';
146
+ }
147
+ if ($hidden_class) {
148
+ $classes[] = $hidden_class;
149
+ }
150
+
151
+ $cap_groups = $caps_groups_manager->get_cap_groups($cap_id, $built_in_wp_caps);
152
+ $classes = array_merge($classes, $cap_groups);
153
+
154
+ $checked = '';
155
+ $disabled = '';
156
+ if ($for_role) {
157
+ if (isset($roles[$current_role]['capabilities'][$cap_id]) &&
158
+ !empty($roles[$current_role]['capabilities'][$cap_id])) {
159
+ $checked = 'checked="checked"';
160
+ }
161
+ } else {
162
+ if (empty($edit_mode)) {
163
+ $disabled = 'disabled="disabled"';
164
+ } else {
165
+ $disabled = '';
166
+ }
167
+ if ($this->lib->user_can($cap_id)) {
168
+ $checked = 'checked="checked"';
169
+ if (!isset($user_to_edit->caps[$cap_id])) {
170
+ $disabled = 'disabled="disabled"';
171
+ }
172
+ }
173
+ }
174
+ $class = 'class="' . implode(' ', $classes) .'"';
175
+ $cap_id_esc = str_replace(' ', URE_SPACE_REPLACER, $cap_id);
176
+ $cap_html = '<div id="ure_cap_div_'. $cap_id_esc .'" '. $class .'><input type="checkbox" name="' . $cap_id_esc . '" id="' .
177
+ $cap_id_esc . '" value="' . $cap_id .'" '. $checked . ' ' . $disabled . ' ' . $onclick_for_admin .
178
+ 'class="ure-cap-cb">';
179
+
180
+
181
+ if ($caps_readable) {
182
+ $cap_ind = 'human';
183
+ $cap_ind_alt = 'inner';
184
+ } else {
185
+ $cap_ind = 'inner';
186
+ $cap_ind_alt = 'human';
187
+ }
188
+ $cap_html .= '<label for="' . $cap_id_esc . '" title="' . $capability[$cap_ind_alt] . '" ' . $label_style . ' > ' .
189
+ $capability[$cap_ind] . '</label> </div>';
190
+
191
+ $output .= $cap_html;
192
+ }
193
+
194
+ echo $output;
195
+ }
196
+ // end of show_capabilities()
197
+
198
+
199
+ // content of User Role Editor Pro advertisement slot - for direct call
200
+ public function advertise_pro() {
201
+ ?>
202
+ <div id="ure_pro_advertisement" style="clear:left;display:block; float: left;">
203
+ <a href="https://www.role-editor.com?utm_source=UserRoleEditor&utm_medium=banner&utm_campaign=Plugins " target="_new" >
204
+ <?php
205
+ $hide_pro_banner = $this->lib->get_option('ure_hide_pro_banner', 0);
206
+ if ($hide_pro_banner) {
207
+ echo 'User Role Editor Pro: extended functionality, no advertisement - from $29.</a>';
208
+ } else {
209
+ ?>
210
+ <img src="<?php echo URE_PLUGIN_URL; ?>images/user-role-editor-pro-728x90.jpg" alt="User Role Editor Pro"
211
+ title="More functionality and premium support with Pro version of User Role Editor."/>
212
+ </a><br />
213
+ <label for="ure_hide_pro_banner">
214
+ <input type="checkbox" name="ure_hide_pro_banner" id="ure_hide_pro_banner" onclick="ure_hide_pro_banner();"/>&nbsp;Thanks, hide this banner.
215
+ </label>
216
+ <?php
217
+ }
218
+ ?>
219
+ </div>
220
+ <?php
221
+ }
222
+ // end of advertise_pro_version()
223
+
224
+
225
+ public function advertise_commercials() {
226
+
227
+ $this->advert = new URE_Advertisement();
228
+ $this->advert->display();
229
+ }
230
+ // end of advertisement()
231
+
232
+
233
+ public function output_confirmation_dialog() {
234
+ ?>
235
+ <div id="ure_confirmation_dialog" class="ure-modal-dialog">
236
+ <div id="ure_cd_html" style="padding:10px;"></div>
237
+ </div>
238
+ <?php
239
+ }
240
+ // end of output_confirmation_dialog()
241
+
242
+
243
+ public function display_caps($for_role = true, $edit_mode=true) {
244
+ ?>
245
+ <table id="ure_role_caps" cellpadding="0" cellspacing="0">
246
+ <tr>
247
+ <td id="ure_role_caps_groups_title"><?php esc_html_e('Group', 'user-role-editor');?></td>
248
+ <td id="ure_role_caps_select">
249
+ <input type="checkbox" id="ure_select_all_caps" name="ure_select_all_caps" value="ure_select_all_caps"/>
250
+ </td>
251
+ <td id="ure_role_caps_quick_filter">
252
+ <?php esc_html_e('Quick filter:', 'user-role-editor'); ?>&nbsp;
253
+ <input type="text" id="quick_filter" name="quick_filter" value="" size="20" onkeyup="ure_filter_capabilities(this.value);" />
254
+ </td>
255
+ </tr>
256
+ <tr>
257
+ <td class="ure-caps-cell" style="padding:0 10px 0 10px;">
258
+ <?php $this->show_caps_groups(); ?>
259
+ </td>
260
+ <td class="ure-caps-cell">
261
+ <?php $this->show_capabilities($for_role, $edit_mode); ?>
262
+ </td>
263
+ <td class="ure-caps-cell">
264
+ <?php $this->toolbar(); ?>
265
+ </td>
266
+ </tr>
267
+ </table>
268
+ <?php
269
+ }
270
+ // end of display_caps()
271
+
272
+ }
273
+ // end of class URE_View
includes/define-constants.php CHANGED
@@ -12,4 +12,4 @@ define('URE_WP_ADMIN_URL', admin_url());
12
  define('URE_ERROR', 'Error is encountered');
13
  define('URE_SPACE_REPLACER', '_URE-SR_');
14
  define('URE_PARENT', is_network_admin() ? 'network/users.php':'users.php');
15
- define('URE_KEY_CAPABILITY', 'ure_edit_roles');
12
  define('URE_ERROR', 'Error is encountered');
13
  define('URE_SPACE_REPLACER', '_URE-SR_');
14
  define('URE_PARENT', is_network_admin() ? 'network/users.php':'users.php');
15
+ define('URE_KEY_CAPABILITY', 'ure_manage_options');
includes/loader.php CHANGED
@@ -19,5 +19,9 @@ require_once(URE_PLUGIN_DIR .'includes/classes/ajax-processor.php');
19
  require_once(URE_PLUGIN_DIR .'includes/classes/screen-help.php');
20
  require_once(URE_PLUGIN_DIR .'includes/classes/known-js-css-compatibility-issues.php');
21
  require_once(URE_PLUGIN_DIR .'includes/classes/role-additional-options.php');
 
 
 
 
22
  require_once(URE_PLUGIN_DIR .'includes/classes/user-role-editor.php');
23
 
19
  require_once(URE_PLUGIN_DIR .'includes/classes/screen-help.php');
20
  require_once(URE_PLUGIN_DIR .'includes/classes/known-js-css-compatibility-issues.php');
21
  require_once(URE_PLUGIN_DIR .'includes/classes/role-additional-options.php');
22
+ require_once(URE_PLUGIN_DIR .'includes/classes/capabilities-groups-manager.php');
23
+ require_once(URE_PLUGIN_DIR .'includes/classes/view.php');
24
+ require_once(URE_PLUGIN_DIR .'includes/classes/role-view.php');
25
+ require_once(URE_PLUGIN_DIR .'includes/classes/user-view.php');
26
  require_once(URE_PLUGIN_DIR .'includes/classes/user-role-editor.php');
27
 
includes/settings-template.php CHANGED
@@ -21,7 +21,7 @@
21
  <li><a href="#ure_tabs-1"><?php esc_html_e('General', 'user-role-editor');?></a></li>
22
  <?php
23
  if (!$license_key_only) {
24
- if ($this->lib->is_pro() || !$this->lib->multisite) {
25
  ?>
26
  <li><a href="#ure_tabs-2"><?php esc_html_e('Additional Modules', 'user-role-editor'); ?></a></li>
27
  <?php
@@ -29,7 +29,7 @@ if (!$license_key_only) {
29
  ?>
30
  <li><a href="#ure_tabs-3"><?php esc_html_e('Default Roles', 'user-role-editor'); ?></a></li>
31
  <?php
32
- if ( $this->lib->multisite && ($this->lib->is_pro() || is_super_admin()) ) {
33
  ?>
34
  <li><a href="#ure_tabs-4"><?php esc_html_e('Multisite', 'user-role-editor'); ?></a></li>
35
  <?php
@@ -103,14 +103,14 @@ if (!$license_key_only) {
103
  </div> <!-- ure_tabs-1 -->
104
  <?php
105
  if (!$license_key_only) {
106
- if ($this->lib->is_pro() || !$this->lib->multisite) {
107
  ?>
108
 
109
  <div id="ure_tabs-2">
110
  <form name="ure_additional_modules" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
111
  <table id="ure_addons">
112
  <?php
113
- if (!$this->lib->multisite) {
114
  ?>
115
  <tr>
116
  <td>
@@ -142,9 +142,9 @@ if (!$this->lib->multisite) {
142
  <div id="ure_tabs-3">
143
  <form name="ure_default_roles" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
144
  <?php
145
- if (!$this->lib->multisite) {
146
  esc_html_e('Primary default role: ', 'user-role-editor');
147
- echo $this->lib->role_default_html;
148
  ?>
149
  <hr>
150
  <?php
@@ -155,7 +155,7 @@ if (!$this->lib->multisite) {
155
  <?php $this->lib->show_other_default_roles(); ?>
156
  </div>
157
  <?php
158
- if ($this->lib->multisite) {
159
  echo '<p>'. esc_html__('Note for multisite environment: take into account that other default roles should exist at the site, in order to be assigned to the new registered users.', 'user-role-editor') .'</p>';
160
  }
161
  ?>
@@ -169,7 +169,7 @@ if (!$this->lib->multisite) {
169
  </div> <!-- ure_tabs-3 -->
170
 
171
  <?php
172
- if ( $this->lib->multisite && ($this->lib->is_pro() || is_super_admin())) {
173
  ?>
174
  <div id="ure_tabs-4">
175
  <div id="ure-settings-form-ms">
21
  <li><a href="#ure_tabs-1"><?php esc_html_e('General', 'user-role-editor');?></a></li>
22
  <?php
23
  if (!$license_key_only) {
24
+ if ($this->lib->is_pro() || !$multisite) {
25
  ?>
26
  <li><a href="#ure_tabs-2"><?php esc_html_e('Additional Modules', 'user-role-editor'); ?></a></li>
27
  <?php
29
  ?>
30
  <li><a href="#ure_tabs-3"><?php esc_html_e('Default Roles', 'user-role-editor'); ?></a></li>
31
  <?php
32
+ if ($multisite && ($this->lib->is_pro() || is_super_admin())) {
33
  ?>
34
  <li><a href="#ure_tabs-4"><?php esc_html_e('Multisite', 'user-role-editor'); ?></a></li>
35
  <?php
103
  </div> <!-- ure_tabs-1 -->
104
  <?php
105
  if (!$license_key_only) {
106
+ if ($this->lib->is_pro() || !$multisite) {
107
  ?>
108
 
109
  <div id="ure_tabs-2">
110
  <form name="ure_additional_modules" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
111
  <table id="ure_addons">
112
  <?php
113
+ if (!$multisite) {
114
  ?>
115
  <tr>
116
  <td>
142
  <div id="ure_tabs-3">
143
  <form name="ure_default_roles" method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE; ?>" >
144
  <?php
145
+ if (!$multisite) {
146
  esc_html_e('Primary default role: ', 'user-role-editor');
147
+ echo $view->role_default_html;
148
  ?>
149
  <hr>
150
  <?php
155
  <?php $this->lib->show_other_default_roles(); ?>
156
  </div>
157
  <?php
158
+ if ($multisite) {
159
  echo '<p>'. esc_html__('Note for multisite environment: take into account that other default roles should exist at the site, in order to be assigned to the new registered users.', 'user-role-editor') .'</p>';
160
  }
161
  ?>
169
  </div> <!-- ure_tabs-3 -->
170
 
171
  <?php
172
+ if ( $multisite && ($this->lib->is_pro() || is_super_admin())) {
173
  ?>
174
  <div id="ure_tabs-4">
175
  <div id="ure-settings-form-ms">
includes/ure-role-edit.php DELETED
@@ -1,104 +0,0 @@
1
- <?php
2
-
3
- /*
4
- *
5
- * User Role Editor plugin: role editor page
6
- *
7
- */
8
-
9
- if (!defined('URE_PLUGIN_URL')) {
10
- die; // Silence is golden, direct call is prohibited
11
- }
12
-
13
- ?>
14
-
15
- <div class="has-sidebar-content">
16
- <div class="postbox" style="float: left; min-width:850px;">
17
- <h3>&nbsp;<?php esc_html_e('Select Role and change its capabilities:', 'user-role-editor'); ?> <?php echo $this->role_select_html; ?></h3>
18
- <div class="inside">
19
- <?php
20
- if ($this->caps_readable) {
21
- $checked = 'checked="checked"';
22
- } else {
23
- $checked = '';
24
- }
25
- $caps_access_restrict_for_simple_admin = $this->get_option('caps_access_restrict_for_simple_admin', 0);
26
- if (is_super_admin() || !$this->multisite || !$this->is_pro() || !$caps_access_restrict_for_simple_admin) {
27
- ?>
28
- <input type="checkbox" name="ure_caps_readable" id="ure_caps_readable" value="1"
29
- <?php echo $checked; ?> onclick="ure_turn_caps_readable(0);"/>
30
- <label for="ure_caps_readable"><?php esc_html_e('Show capabilities in human readable form', 'user-role-editor'); ?></label>&nbsp;&nbsp;
31
- <?php
32
- if ($this->show_deprecated_caps) {
33
- $checked = 'checked="checked"';
34
- } else {
35
- $checked = '';
36
- }
37
- ?>
38
- <input type="checkbox" name="ure_show_deprecated_caps" id="ure_show_deprecated_caps" value="1"
39
- <?php echo $checked; ?> onclick="ure_turn_deprecated_caps(0);"/>
40
- <label for="ure_show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label>
41
- <?php
42
- }
43
- if ($this->multisite && $this->active_for_network && !is_network_admin() && is_main_site( get_current_blog_id() ) && is_super_admin()) {
44
- $hint = esc_html__('If checked, then apply action to ALL sites of this Network');
45
- if ($this->apply_to_all) {
46
- $checked = 'checked="checked"';
47
- $fontColor = 'color:#FF0000;';
48
- } else {
49
- $checked = '';
50
- $fontColor = '';
51
- }
52
- ?>
53
- <div style="float: right; margin-left:10px; margin-right: 20px; <?php echo $fontColor;?>" id="ure_apply_to_all_div">
54
- <input type="checkbox" name="ure_apply_to_all" id="ure_apply_to_all" value="1"
55
- <?php echo $checked; ?> title="<?php echo $hint;?>" onclick="ure_applyToAllOnClick(this)"/>
56
- <label for="ure_apply_to_all" title="<?php echo $hint;?>"><?php esc_html_e('Apply to All Sites', 'user-role-editor');?></label>
57
- </div>
58
- <?php
59
- }
60
- ?>
61
- <br /><br />
62
- <hr />
63
- <?php esc_html_e('Core capabilities:', 'user-role-editor'); ?>
64
- <div style="display:table-inline; float: right; margin-right: 12px;">
65
- <?php esc_html_e('Quick filter:', 'user-role-editor'); ?>&nbsp;
66
- <input type="text" id="quick_filter" name="quick_filter" value="" size="20" onkeyup="ure_filter_capabilities(this.value);" />
67
- </div>
68
-
69
- <table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
70
- <tr>
71
- <td style="vertical-align:top;">
72
- <?php $this->show_capabilities( true, true ); ?>
73
- </td>
74
- <td>
75
- <?php $this->toolbar(!empty($this->role_delete_html), !empty($this->capability_remove_html));?>
76
- </td>
77
- </tr>
78
- </table>
79
- <?php
80
- $quant = count( $this->full_capabilities ) - count( $this->get_built_in_wp_caps() );
81
- if ($quant>0) {
82
- echo '<hr />';
83
- esc_html_e('Custom capabilities:', 'user-role-editor');
84
- ?>
85
- <table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
86
- <tr>
87
- <td style="vertical-align:top;">
88
- <?php $this->show_capabilities( false, true ); ?>
89
- </td>
90
- <td></td>
91
- </tr>
92
- </table>
93
- <?php
94
- } // if ($quant>0)
95
-
96
- $this->role_additional_options->show($this->current_role);
97
-
98
- ?>
99
- <input type="hidden" name="object" value="role" />
100
- <?php
101
- $this->display_box_end();
102
- ?>
103
- <div style="clear: left; float: left; width: 800px;"></div>
104
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/ure-user-edit.php DELETED
@@ -1,161 +0,0 @@
1
- <?php
2
-
3
- /*
4
- *
5
- * User Role Editor plugin: user capabilities editor page
6
- *
7
- */
8
-
9
- if (!defined('URE_PLUGIN_URL')) {
10
- die; // Silence is golden, direct call is prohibited
11
- }
12
-
13
- $edit_user_caps_mode = $this->get_edit_user_caps_mode();
14
- ?>
15
-
16
- <div class="has-sidebar-content">
17
- <?php
18
- $switch_to_user = '';
19
- if (!is_multisite() || current_user_can('manage_network_users')) {
20
- $anchor_start = '<a href="' . wp_nonce_url("user-edit.php?user_id={$this->user_to_edit->ID}",
21
- "ure_user_{$this->user_to_edit->ID}") .'" >';
22
- $anchor_end = '</a>';
23
- if (class_exists('user_switching') && current_user_can('switch_to_user', $this->user_to_edit->ID)) {
24
- $switch_to_user_link = user_switching::switch_to_url($this->user_to_edit);
25
- $switch_to_user = '<a href="'. esc_url($switch_to_user_link) .'">'. esc_html__('Switch&nbsp;To', 'user-switching') .'</a>';
26
- }
27
- } else {
28
- $anchor_start = '';
29
- $anchor_end = '';
30
- }
31
- $user_info = ' <span style="font-weight: bold;">'.$anchor_start. $this->user_to_edit->user_login;
32
- if ($this->user_to_edit->display_name!==$this->user_to_edit->user_login) {
33
- $user_info .= ' ('.$this->user_to_edit->display_name.')';
34
- }
35
- $user_info .= $anchor_end.'</span>';
36
- if (is_multisite() && is_super_admin($this->user_to_edit->ID)) {
37
- $user_info .= ' <span style="font-weight: bold; color:red;">'. esc_html__('Network Super Admin', 'user-role-editor') .'</span>';
38
- }
39
-
40
- if (!empty($switch_to_user)) {
41
- $user_info .= '&nbsp;&nbsp;&nbsp;&nbsp;'. $switch_to_user;
42
- }
43
-
44
-
45
- $this->display_box_start(esc_html__('Change capabilities for user', 'user-role-editor'). $user_info, 'min-width:1100px;');
46
-
47
- ?>
48
- <table cellpadding="0" cellspacing="0" style="width: 100%;">
49
- <tr>
50
- <td>&nbsp;</td>
51
- <td style="padding-left: 10px; padding-bottom: 5px;">
52
- <?php
53
- $caps_access_restrict_for_simple_admin = $this->get_option('caps_access_restrict_for_simple_admin', 0);
54
- if (is_super_admin() || !$this->multisite || !class_exists('User_Role_Editor_Pro') || !$caps_access_restrict_for_simple_admin) {
55
- if ($this->caps_readable) {
56
- $checked = 'checked="checked"';
57
- } else {
58
- $checked = '';
59
- }
60
- ?>
61
-
62
- <input type="checkbox" name="ure_caps_readable" id="ure_caps_readable" value="1"
63
- <?php echo $checked; ?> onclick="ure_turn_caps_readable(<?php echo $this->user_to_edit->ID; ?>);" />
64
- <label for="ure_caps_readable"><?php esc_html_e('Show capabilities in human readable form', 'user-role-editor'); ?></label>&nbsp;&nbsp;&nbsp;
65
- <?php
66
- if ($this->show_deprecated_caps) {
67
- $checked = 'checked="checked"';
68
- } else {
69
- $checked = '';
70
- }
71
- ?>
72
- <input type="checkbox" name="ure_show_deprecated_caps" id="ure_show_deprecated_caps" value="1"
73
- <?php echo $checked; ?> onclick="ure_turn_deprecated_caps(<?php echo $this->user_to_edit->ID; ?>);"/>
74
- <label for="ure_show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities', 'user-role-editor'); ?></label>
75
- <?php
76
- }
77
- ?>
78
- </td>
79
- </tr>
80
- <tr>
81
- <td class="ure-user-roles">
82
- <div style="margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('Primary Role:', 'user-role-editor'); ?></div>
83
- <?php
84
- $show_admin_role = $this->show_admin_role_allowed();
85
- // output primary role selection dropdown list
86
- $this->user_primary_role_dropdown_list($this->user_to_edit->roles);
87
-
88
- $values = array_values($this->user_to_edit->roles);
89
- $primary_role = array_shift($values); // get 1st element from roles array
90
- if (function_exists('bbp_filter_blog_editable_roles') ) { // bbPress plugin is active
91
- ?>
92
- <div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('bbPress Role:', 'user-role-editor'); ?></div>
93
- <?php
94
- // Get the roles
95
- $dynamic_roles = bbp_get_dynamic_roles();
96
- $bbp_user_role = bbp_get_user_role($this->user_to_edit->ID);
97
- if (!empty($bbp_user_role)) {
98
- echo $dynamic_roles[$bbp_user_role]['name'];
99
- }
100
- }
101
- ?>
102
- <div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php esc_html_e('Other Roles:', 'user-role-editor'); ?></div>
103
- <?php
104
-
105
- foreach ($this->roles as $role_id => $role) {
106
- if ( ($show_admin_role || $role_id!='administrator') && ($role_id!==$primary_role) ) {
107
- if ( $this->user_can( $role_id ) ) {
108
- $checked = 'checked="checked"';
109
- } else {
110
- $checked = '';
111
- }
112
- echo '<label for="wp_role_' . $role_id .'"><input type="checkbox" id="wp_role_' . $role_id .
113
- '" name="wp_role_' . $role_id . '" value="' . $role_id . '"' . $checked .' />&nbsp;' .
114
- esc_html__($role['name'], 'user-role-editor') . '</label><br />';
115
- }
116
- }
117
- ?>
118
- </td>
119
- <td style="padding-left: 5px; padding-top: 5px; border-top: 1px solid #ccc;">
120
- <span style="font-weight: bold;"><?php esc_html_e('Core capabilities:', 'user-role-editor'); ?></span>
121
- <div style="display:table-inline; float: right; margin-right: 12px;">
122
- <?php esc_html_e('Quick filter:', 'user-role-editor'); ?>&nbsp;
123
- <input type="text" id="quick_filter" name="quick_filter" value="" size="20" onkeyup="ure_filter_capabilities(this.value);" />
124
- </div>
125
-
126
- <table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
127
- <tr>
128
- <td style="vertical-align:top;">
129
- <?php $this->show_capabilities( true, false, $edit_user_caps_mode ); ?>
130
- </td>
131
- <td>
132
- <?php $this->toolbar();?>
133
- </td>
134
- </tr>
135
- </table>
136
- <?php
137
- $quant = count( $this->full_capabilities ) - count( $this->get_built_in_wp_caps() );
138
- if ($quant>0) {
139
- echo '<hr />';
140
- ?>
141
- <span style="font-weight: bold;"><?php esc_html_e('Custom capabilities:', 'user-role-editor'); ?></span>
142
- <table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
143
- <tr>
144
- <td style="vertical-align:top;">
145
- <?php $this->show_capabilities( false, false, $edit_user_caps_mode ); ?>
146
- </td>
147
- </tr>
148
- </table>
149
- <?php
150
- } // if ($quant>0)
151
- ?>
152
- </td>
153
- </tr>
154
- </table>
155
- <input type="hidden" name="object" value="user" />
156
- <input type="hidden" name="user_id" value="<?php echo $this->user_to_edit->ID; ?>" />
157
- <?php
158
- $this->display_box_end();
159
- ?>
160
-
161
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/ure-js.js CHANGED
@@ -1,3 +1,5 @@
 
 
1
  // get/post via jQuery
2
  (function ($) {
3
  $.extend({
@@ -28,14 +30,28 @@ function ure_ui_button_text(caption) {
28
  }
29
 
30
 
 
 
 
 
 
 
 
 
 
 
31
  jQuery(function ($) {
32
 
33
- $('#ure_select_all').button({
34
- label: ure_data.select_all
35
- }).click(function (event) {
36
- event.preventDefault();
37
- ure_select_all(1);
 
 
38
  });
 
 
39
 
40
  if (typeof ure_current_role === 'undefined' || 'administrator' !== ure_current_role) {
41
  $('#ure_unselect_all').button({
@@ -444,6 +460,42 @@ function ure_select_all(selected) {
444
  // end of ure_select_all()
445
 
446
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  function ure_turn_caps_readable(user_id) {
448
  var ure_object = 'user';
449
  if (user_id === 0) {
@@ -479,14 +531,14 @@ function ure_role_change(role_name) {
479
 
480
 
481
  function ure_filter_capabilities(cap_id) {
482
- var div_list = jQuery("div[id^='ure_div_cap_']");
483
  for (i = 0; i < div_list.length; i++) {
484
  if (cap_id !== '' && div_list[i].id.substr(11).indexOf(cap_id) !== -1) {
485
- div_list[i].ure_tag = true;
486
  div_list[i].style.color = '#27CF27';
487
  } else {
488
  div_list[i].style.color = '#000000';
489
- div_list[i].ure_tag = false;
490
  }
491
  }
492
  ;
@@ -501,3 +553,39 @@ function ure_hide_pro_banner() {
501
 
502
  }
503
  // end of ure_hide_this_banner()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var ure_obj = {selected_group: 'all'};
2
+
3
  // get/post via jQuery
4
  (function ($) {
5
  $.extend({
30
  }
31
 
32
 
33
+ function ure_select_selectable_element(selectable_container, elements_to_select) {
34
+ // add unselecting class to all elements in the styleboard canvas except the ones to select
35
+ jQuery(".ui-selected", selectable_container).not(elements_to_select).removeClass("ui-selected").addClass("ui-unselecting");
36
+ // add ui-selecting class to the elements to select
37
+ jQuery(elements_to_select).not(".ui-selected").addClass("ui-selecting");
38
+ // trigger the mouse stop event (this will select all .ui-selecting elements, and deselect all .ui-unselecting elements)
39
+ selectable_container.data("ui-selectable")._mouseStop(null);
40
+ }
41
+
42
+
43
  jQuery(function ($) {
44
 
45
+ $('#ure_select_all_caps').click(ure_auto_select_caps);
46
+ $('#ure_caps_groups_list').selectable({
47
+ selected: function( event, ui ) {
48
+ // do not allow multiple selection
49
+ $(ui.selected).siblings().removeClass("ui-selected");
50
+ ure_caps_refresh(ui.selected.id);
51
+ }
52
  });
53
+
54
+ ure_select_selectable_element($('#ure_caps_groups_list'), $('#ure_caps_group_all'));
55
 
56
  if (typeof ure_current_role === 'undefined' || 'administrator' !== ure_current_role) {
57
  $('#ure_unselect_all').button({
460
  // end of ure_select_all()
461
 
462
 
463
+ function ure_apply_selection(cb_id) {
464
+ var qfilter = jQuery('#quick_filter').val();
465
+ var parent_div = jQuery('#ure_cap_div_'+ cb_id);
466
+ var disabled = jQuery('#'+ cb_id).attr('disabled');
467
+ var result = false;
468
+ if (parent_div.hasClass(ure_obj.selected_group) && // make selection inside currently selected group of capabilities only
469
+ !parent_div.hasClass('hidden') && disabled!=='disabled') { // select not hidden and not disabled checkboxes (capabilities) only
470
+ // if quick filter is not empty, then apply selection to the tagged element only
471
+ if (qfilter==='' || parent_div.hasClass('ure_tag')) {
472
+ result = true;
473
+ }
474
+ }
475
+
476
+ return result;
477
+ }
478
+
479
+
480
+ function ure_auto_select_caps(event) {
481
+ jQuery(function($) {
482
+ if (event.shiftKey) {
483
+ $('.ure-cap-cb').each(function () { // reverse selection
484
+ if (ure_apply_selection(this.id)) {
485
+ $(this).prop('checked', !$(this).prop('checked'));
486
+ }
487
+ });
488
+ } else {
489
+ $('.ure-cap-cb').each(function () { // switch On/Off all checkboxes
490
+ if (ure_apply_selection(this.id)) {
491
+ $(this).prop('checked', $('#ure_select_all_caps').prop('checked'));
492
+ }
493
+ });
494
+ }
495
+ });
496
+ }
497
+
498
+
499
  function ure_turn_caps_readable(user_id) {
500
  var ure_object = 'user';
501
  if (user_id === 0) {
531
 
532
 
533
  function ure_filter_capabilities(cap_id) {
534
+ var div_list = jQuery('.ure-cap-div');
535
  for (i = 0; i < div_list.length; i++) {
536
  if (cap_id !== '' && div_list[i].id.substr(11).indexOf(cap_id) !== -1) {
537
+ jQuery('#'+ div_list[i].id).addClass('ure_tag');
538
  div_list[i].style.color = '#27CF27';
539
  } else {
540
  div_list[i].style.color = '#000000';
541
+ jQuery('#'+ div_list[i].id).removeClass('ure_tag');
542
  }
543
  }
544
  ;
553
 
554
  }
555
  // end of ure_hide_this_banner()
556
+
557
+
558
+ function ure_caps_refresh(group) {
559
+
560
+ var group_id = group.substr(15);
561
+ ure_obj.selected_group = group_id;
562
+ if (group_id === 'all') {
563
+ jQuery('.ure-cap-div').each(function () {
564
+ if (jQuery(this).hasClass('hidden') && !jQuery(this).hasClass('deprecated')) {
565
+ jQuery(this).removeClass('hidden');
566
+ }
567
+ });
568
+ return;
569
+ }
570
+
571
+ var show_deprecated = jQuery('#ure_show_deprecated_caps').attr('checked');
572
+ jQuery('.ure-cap-div').each(function () {
573
+ if (jQuery(this).hasClass(group_id)) {
574
+ if (jQuery(this).hasClass('hidden')) {
575
+ if (!jQuery(this).hasClass('blocked')) {
576
+ if (jQuery(this).hasClass('deprecated')) {
577
+ if (group_id==='deprecated' || show_deprecated) {
578
+ jQuery(this).removeClass('hidden');
579
+ }
580
+ } else {
581
+ jQuery(this).removeClass('hidden');
582
+ }
583
+ }
584
+ }
585
+ } else {
586
+ if (!jQuery(this).hasClass('hidden')) {
587
+ jQuery(this).addClass('hidden');
588
+ }
589
+ }
590
+ });
591
+ }
lang/user-role-editor.mo CHANGED
Binary file
lang/user-role-editor.pot CHANGED
@@ -2,9 +2,9 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: User Role Editor 4.19.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2015-12-11 11:28+0700\n"
6
  "PO-Revision-Date: \n"
7
- "Last-Translator: Vladimir Garagulya <support@role-editor.com>\n"
8
  "Language-Team: https://www.role-editor.com <support@role-editor.com>\n"
9
  "Language: en_EN\n"
10
  "MIME-Version: 1.0\n"
@@ -16,848 +16,891 @@ msgstr ""
16
  "X-Generator: Poedit 1.5.4\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
- #: ../includes/ure-role-edit.php:17
20
- msgid "Select Role and change its capabilities:"
21
- msgstr ""
22
-
23
- #: ../includes/ure-role-edit.php:30 ../includes/ure-user-edit.php:54
24
- msgid "Show capabilities in human readable form"
25
- msgstr ""
26
-
27
- #: ../includes/ure-role-edit.php:40 ../includes/settings-template.php:69
28
- #: ../includes/ure-user-edit.php:64 ../includes/class-ure-screen-help.php:21
29
- msgid "Show deprecated capabilities"
30
- msgstr ""
31
-
32
- #: ../includes/ure-role-edit.php:44
33
- msgid "If checked, then apply action to ALL sites of this Network"
34
- msgstr ""
35
-
36
- #: ../includes/ure-role-edit.php:56
37
- msgid "Apply to All Sites"
38
- msgstr ""
39
-
40
- #: ../includes/ure-role-edit.php:63 ../includes/ure-user-edit.php:110
41
- msgid "Core capabilities:"
42
- msgstr ""
43
-
44
- #: ../includes/ure-role-edit.php:65 ../includes/ure-user-edit.php:112
45
- msgid "Quick filter:"
46
- msgstr ""
47
-
48
- #: ../includes/ure-role-edit.php:83 ../includes/ure-user-edit.php:131
49
- msgid "Custom capabilities:"
50
- msgstr ""
51
-
52
- #: ../includes/class-user-role-editor.php:231
53
- msgid "Change role for users without role"
54
- msgstr ""
55
-
56
- #: ../includes/class-user-role-editor.php:232
57
- msgid "No rights"
58
- msgstr ""
59
-
60
- #: ../includes/class-user-role-editor.php:233
61
- msgid "Provide new role"
62
- msgstr ""
63
-
64
- #: ../includes/class-user-role-editor.php:296
65
- #: ../includes/class-user-role-editor.php:298
66
- msgid "You do not have permission to edit this user."
67
- msgstr ""
68
-
69
- #: ../includes/class-user-role-editor.php:322
70
- #: ../includes/class-user-other-roles.php:162
71
- msgid "Capabilities"
72
- msgstr ""
73
-
74
- #: ../includes/class-user-role-editor.php:415
75
- msgid "Settings"
76
- msgstr ""
77
-
78
- #: ../includes/class-user-role-editor.php:426
79
- #: ../includes/class-ure-lib.php:2564
80
- msgid "Changelog"
81
  msgstr ""
82
 
83
- #: ../includes/class-user-role-editor.php:448
84
  #: ../includes/settings-template.php:21
 
 
85
  msgid "General"
86
  msgstr ""
87
 
88
- #: ../includes/class-user-role-editor.php:454
89
  #: ../includes/settings-template.php:26
 
90
  msgid "Additional Modules"
91
  msgstr ""
92
 
93
- #: ../includes/class-user-role-editor.php:460
94
  #: ../includes/settings-template.php:30
 
95
  msgid "Default Roles"
96
  msgstr ""
97
 
98
- #: ../includes/class-user-role-editor.php:466
99
  #: ../includes/settings-template.php:34
 
 
100
  msgid "Multisite"
101
  msgstr ""
102
 
103
- #: ../includes/class-user-role-editor.php:476
104
- #: ../includes/class-user-role-editor.php:505
105
- #: ../includes/class-ure-lib.php:357
106
- msgid "User Role Editor"
107
- msgstr ""
108
-
109
- #: ../includes/class-user-role-editor.php:568
110
- #: ../includes/class-user-role-editor.php:586
111
- #: ../includes/class-user-role-editor.php:630
112
- msgid "User Role Editor options are updated"
113
- msgstr ""
114
-
115
- #: ../includes/class-user-role-editor.php:614
116
- msgid "Default Roles are updated"
117
- msgstr ""
118
-
119
- #: ../includes/class-user-role-editor.php:639
120
- msgid ""
121
- "You do not have sufficient permissions to manage options for User Role "
122
- "Editor."
123
- msgstr ""
124
-
125
- #: ../includes/class-user-role-editor.php:712
126
- #: ../includes/class-ure-lib.php:1747 ../includes/class-ure-lib.php:2006
127
- #: ../includes/class-ure-lib.php:2122 ../includes/class-ure-lib.php:2170
128
- #: ../includes/class-ure-lib.php:2421 ../includes/class-ure-lib.php:2466
129
- msgid "Insufficient permissions to work with User Role Editor"
130
- msgstr ""
131
-
132
- #: ../includes/class-user-role-editor.php:772
133
- msgid "Confirm"
134
- msgstr ""
135
-
136
- #: ../includes/class-user-role-editor.php:773
137
- msgid "Yes"
138
- msgstr ""
139
-
140
- #: ../includes/class-user-role-editor.php:774
141
- msgid "No"
142
- msgstr ""
143
-
144
- #: ../includes/class-user-role-editor.php:775
145
- msgid "Select All"
146
- msgstr ""
147
-
148
- #: ../includes/class-user-role-editor.php:776
149
- msgid "Unselect All"
150
- msgstr ""
151
-
152
- #: ../includes/class-user-role-editor.php:777
153
- msgid "Reverse"
154
- msgstr ""
155
-
156
- #: ../includes/class-user-role-editor.php:778
157
- msgid "Update"
158
- msgstr ""
159
-
160
- #: ../includes/class-user-role-editor.php:779
161
- msgid "Please confirm permissions update"
162
- msgstr ""
163
-
164
- #: ../includes/class-user-role-editor.php:780
165
- msgid "Add New Role"
166
- msgstr ""
167
-
168
- #: ../includes/class-user-role-editor.php:781
169
- #: ../includes/class-user-role-editor.php:786
170
- msgid "Rename Role"
171
- msgstr ""
172
-
173
- #: ../includes/class-user-role-editor.php:782
174
- msgid " Role name (ID) can not be empty!"
175
- msgstr ""
176
-
177
- #: ../includes/class-user-role-editor.php:783
178
- msgid ""
179
- " Role name (ID) must contain latin characters, digits, hyphens or underscore "
180
- "only!"
181
  msgstr ""
182
 
183
- #: ../includes/class-user-role-editor.php:784
184
- msgid ""
185
- " WordPress does not support numeric Role name (ID). Add latin characters to "
186
- "it."
187
  msgstr ""
188
 
189
- #: ../includes/class-user-role-editor.php:785
190
- msgid "Add Role"
191
  msgstr ""
192
 
193
- #: ../includes/class-user-role-editor.php:787
194
- msgid "Delete Role"
 
 
195
  msgstr ""
196
 
197
- #: ../includes/class-user-role-editor.php:788
198
- msgid "Cancel"
199
  msgstr ""
200
 
201
- #: ../includes/class-user-role-editor.php:789
202
- msgid "Add Capability"
203
  msgstr ""
204
 
205
- #: ../includes/class-user-role-editor.php:790
206
- #: ../includes/class-user-role-editor.php:799
207
- msgid "Delete Capability"
208
  msgstr ""
209
 
210
- #: ../includes/class-user-role-editor.php:791
211
- msgid "Reset"
 
212
  msgstr ""
213
 
214
- #: ../includes/class-user-role-editor.php:792
215
- msgid "DANGER! Resetting will restore default settings from WordPress Core."
216
  msgstr ""
217
 
218
- #: ../includes/class-user-role-editor.php:793
219
- msgid ""
220
- "If any plugins have changed capabilities in any way upon installation (such "
221
- "as S2Member, WooCommerce, and many more), those capabilities will be DELETED!"
222
  msgstr ""
223
 
224
- #: ../includes/class-user-role-editor.php:794
225
  msgid ""
226
- "For more information on how to undo changes and restore plugin capabilities "
227
- "go to"
 
228
  msgstr ""
229
 
230
- #: ../includes/class-user-role-editor.php:796
231
- msgid "Continue?"
232
  msgstr ""
233
 
234
- #: ../includes/class-user-role-editor.php:797
235
- msgid "Default Role"
236
  msgstr ""
237
 
238
- #: ../includes/class-user-role-editor.php:798
239
- msgid "Set New Default Role"
240
  msgstr ""
241
 
242
- #: ../includes/class-user-role-editor.php:800
243
- msgid ""
244
- "Warning! Be careful - removing critical capability could crash some plugin "
245
- "or other custom code"
246
  msgstr ""
247
 
248
- #: ../includes/class-user-role-editor.php:801
249
- msgid " Capability name (ID) can not be empty!"
250
  msgstr ""
251
 
252
- #: ../includes/class-user-role-editor.php:802
253
- msgid ""
254
- " Capability name (ID) must contain latin characters, digits, hyphens or "
255
- "underscore only!"
256
  msgstr ""
257
 
258
- #: ../includes/class-role-additional-options.php:53
259
- msgid "Hide admin bar"
260
  msgstr ""
261
 
262
- #: ../includes/class-role-additional-options.php:103
263
- msgid "Additional Options"
264
  msgstr ""
265
 
266
- #: ../includes/settings-template.php:17
267
- msgid "User Role Editor - Options"
268
  msgstr ""
269
 
270
- #: ../includes/settings-template.php:39
271
- msgid "About"
272
  msgstr ""
273
 
274
- #: ../includes/settings-template.php:53
275
- #: ../includes/class-ure-screen-help.php:15
276
- msgid "Show Administrator role at User Role Editor"
277
  msgstr ""
278
 
279
- #: ../includes/settings-template.php:61
280
- #: ../includes/class-ure-screen-help.php:18
281
- msgid "Show capabilities in the human readable form"
282
  msgstr ""
283
 
284
- #: ../includes/settings-template.php:77
285
- msgid "Confirm role update"
286
  msgstr ""
287
 
288
- #: ../includes/settings-template.php:85
289
- #: ../includes/class-ure-screen-help.php:25
290
- msgid "Edit user capabilities"
291
  msgstr ""
292
 
293
- #: ../includes/settings-template.php:98 ../includes/settings-template.php:134
294
- #: ../includes/settings-template.php:166 ../includes/settings-template.php:198
295
- msgid "Save"
296
  msgstr ""
297
 
298
- #: ../includes/settings-template.php:119
299
- #: ../includes/class-ure-screen-help.php:45
300
- msgid "Count users without role"
301
  msgstr ""
302
 
303
- #: ../includes/settings-template.php:146
304
- msgid "Primary default role: "
305
  msgstr ""
306
 
307
- #: ../includes/settings-template.php:153
308
- msgid "Other default roles for new registered user: "
309
  msgstr ""
310
 
311
- #: ../includes/settings-template.php:159
312
- msgid ""
313
- "Note for multisite environment: take into account that other default roles "
314
- "should exist at the site, in order to be assigned to the new registered "
315
- "users."
316
  msgstr ""
317
 
318
- #: ../includes/settings-template.php:185
319
- msgid "Allow non super administrators to create, edit, and delete users"
320
  msgstr ""
321
 
322
- #: ../includes/class-user-other-roles.php:82
323
- #: ../includes/class-user-other-roles.php:183
324
- #: ../includes/class-user-other-roles.php:243
325
  msgid "Other Roles"
326
  msgstr ""
327
 
328
- #: ../includes/class-user-other-roles.php:83
329
  msgid "Select additional roles for this user"
330
  msgstr ""
331
 
332
- #: ../includes/class-user-other-roles.php:169
 
 
 
 
 
333
  msgid "Edit"
334
  msgstr ""
335
 
336
- #: ../includes/class-user-other-roles.php:215
337
  msgid "Additional Capabilities"
338
  msgstr ""
339
 
340
- #: ../includes/class-ure-lib.php:255
341
  msgid "Error: wrong request"
342
  msgstr ""
343
 
344
- #: ../includes/class-ure-lib.php:288 ../includes/class-ure-lib.php:299
345
- msgid "Role name (ID): "
346
- msgstr ""
347
-
348
- #: ../includes/class-ure-lib.php:290 ../includes/class-ure-lib.php:301
349
- msgid "Display Role Name: "
350
- msgstr ""
351
-
352
- #: ../includes/class-ure-lib.php:292
353
- msgid "Make copy of: "
354
- msgstr ""
355
-
356
- #: ../includes/class-ure-lib.php:308
357
- msgid "Select Role:"
358
- msgstr ""
359
-
360
- #: ../includes/class-ure-lib.php:327
361
- msgid "Delete:"
362
- msgstr ""
363
-
364
- #: ../includes/class-ure-lib.php:334
365
- msgid "Capability name (ID): "
366
  msgstr ""
367
 
368
- #: ../includes/class-ure-lib.php:454
369
  msgid "Error: "
370
  msgstr ""
371
 
372
- #: ../includes/class-ure-lib.php:454
373
  msgid "Role"
374
  msgstr ""
375
 
376
- #: ../includes/class-ure-lib.php:455
377
  msgid "does not exist"
378
  msgstr ""
379
 
380
- #: ../includes/class-ure-lib.php:498
381
  msgid "Role is updated successfully"
382
  msgstr ""
383
 
384
- #: ../includes/class-ure-lib.php:500
385
  msgid "Roles are updated for all network"
386
  msgstr ""
387
 
388
- #: ../includes/class-ure-lib.php:506
389
  msgid "Error occured during role(s) update"
390
  msgstr ""
391
 
392
- #: ../includes/class-ure-lib.php:513
393
  msgid "User capabilities are updated successfully"
394
  msgstr ""
395
 
396
- #: ../includes/class-ure-lib.php:518
397
  msgid "Error occured during user update"
398
  msgstr ""
399
 
400
- #: ../includes/class-ure-lib.php:576
401
  msgid "User Roles are restored to WordPress default values. "
402
  msgstr ""
403
 
404
- #: ../includes/class-ure-lib.php:1465
405
  msgid "read about"
406
  msgstr ""
407
 
408
- #: ../includes/class-ure-lib.php:1466
409
  msgid "user capability"
410
  msgstr ""
411
 
412
- #: ../includes/class-ure-lib.php:1467
413
  msgid "Help"
414
  msgstr ""
415
 
416
- #: ../includes/class-ure-lib.php:1969
 
 
 
 
 
 
 
417
  msgid "Error is occur. Please check the log file."
418
  msgstr ""
419
 
420
- #: ../includes/class-ure-lib.php:2015 ../includes/class-ure-lib.php:2082
421
  msgid ""
422
  "Error: Role ID must contain latin characters, digits, hyphens or underscore "
423
  "only!"
424
  msgstr ""
425
 
426
- #: ../includes/class-ure-lib.php:2019 ../includes/class-ure-lib.php:2086
427
  msgid ""
428
  "Error: WordPress does not support numeric Role name (ID). Add latin "
429
  "characters to it."
430
  msgstr ""
431
 
432
- #: ../includes/class-ure-lib.php:2034
433
  #, php-format
434
  msgid "Role %s exists already"
435
  msgstr ""
436
 
437
- #: ../includes/class-ure-lib.php:2049
438
  msgid "Error is encountered during new role create operation"
439
  msgstr ""
440
 
441
- #: ../includes/class-ure-lib.php:2051
442
  #, php-format
443
  msgid "Role %s is created successfully"
444
  msgstr ""
445
 
446
- #: ../includes/class-ure-lib.php:2075
447
  msgid "Error: Role ID is empty!"
448
  msgstr ""
449
 
450
- #: ../includes/class-ure-lib.php:2093
451
  msgid "Error: Empty role display name is not allowed."
452
  msgstr ""
453
 
454
- #: ../includes/class-ure-lib.php:2100
455
  #, php-format
456
  msgid "Role %s does not exists"
457
  msgstr ""
458
 
459
- #: ../includes/class-ure-lib.php:2108
460
  #, php-format
461
  msgid "Role %s is renamed to %s successfully"
462
  msgstr ""
463
 
464
- #: ../includes/class-ure-lib.php:2181
465
  msgid "Error encountered during role delete operation"
466
  msgstr ""
467
 
468
- #: ../includes/class-ure-lib.php:2183
469
  msgid "Unused roles are deleted successfully"
470
  msgstr ""
471
 
472
- #: ../includes/class-ure-lib.php:2185
473
  #, php-format
474
  msgid "Role %s is deleted successfully"
475
  msgstr ""
476
 
477
- #: ../includes/class-ure-lib.php:2216
478
  msgid "Error encountered during default role change operation"
479
  msgstr ""
480
 
481
- #: ../includes/class-ure-lib.php:2219
482
  #, php-format
483
  msgid "Default role for new users is set to %s successfully"
484
  msgstr ""
485
 
486
- #: ../includes/class-ure-lib.php:2222
487
  msgid "Can not set Administrator role as a default one"
488
  msgstr ""
489
 
490
- #: ../includes/class-ure-lib.php:2224
491
  msgid "This role does not exist - "
492
  msgstr ""
493
 
494
- #: ../includes/class-ure-lib.php:2240
495
  msgid "Editor"
496
  msgstr ""
497
 
498
- #: ../includes/class-ure-lib.php:2241
499
  msgid "Author"
500
  msgstr ""
501
 
502
- #: ../includes/class-ure-lib.php:2242
503
  msgid "Contributor"
504
  msgstr ""
505
 
506
- #: ../includes/class-ure-lib.php:2243
507
  msgid "Subscriber"
508
  msgstr ""
509
 
510
- #: ../includes/class-ure-lib.php:2245
511
  msgid "Switch themes"
512
  msgstr ""
513
 
514
- #: ../includes/class-ure-lib.php:2246
515
  msgid "Edit themes"
516
  msgstr ""
517
 
518
- #: ../includes/class-ure-lib.php:2247
519
  msgid "Activate plugins"
520
  msgstr ""
521
 
522
- #: ../includes/class-ure-lib.php:2248
523
  msgid "Edit plugins"
524
  msgstr ""
525
 
526
- #: ../includes/class-ure-lib.php:2249
527
  msgid "Edit users"
528
  msgstr ""
529
 
530
- #: ../includes/class-ure-lib.php:2250
531
  msgid "Edit files"
532
  msgstr ""
533
 
534
- #: ../includes/class-ure-lib.php:2251
535
  msgid "Manage options"
536
  msgstr ""
537
 
538
- #: ../includes/class-ure-lib.php:2252
539
  msgid "Moderate comments"
540
  msgstr ""
541
 
542
- #: ../includes/class-ure-lib.php:2253
543
  msgid "Manage categories"
544
  msgstr ""
545
 
546
- #: ../includes/class-ure-lib.php:2254
547
  msgid "Manage links"
548
  msgstr ""
549
 
550
- #: ../includes/class-ure-lib.php:2255
551
  msgid "Upload files"
552
  msgstr ""
553
 
554
- #: ../includes/class-ure-lib.php:2256
555
  msgid "Import"
556
  msgstr ""
557
 
558
- #: ../includes/class-ure-lib.php:2257
559
  msgid "Unfiltered html"
560
  msgstr ""
561
 
562
- #: ../includes/class-ure-lib.php:2258
563
  msgid "Edit posts"
564
  msgstr ""
565
 
566
- #: ../includes/class-ure-lib.php:2259
567
  msgid "Edit others posts"
568
  msgstr ""
569
 
570
- #: ../includes/class-ure-lib.php:2260
571
  msgid "Edit published posts"
572
  msgstr ""
573
 
574
- #: ../includes/class-ure-lib.php:2261
575
  msgid "Publish posts"
576
  msgstr ""
577
 
578
- #: ../includes/class-ure-lib.php:2262
579
  msgid "Edit pages"
580
  msgstr ""
581
 
582
- #: ../includes/class-ure-lib.php:2263
583
  msgid "Read"
584
  msgstr ""
585
 
586
- #: ../includes/class-ure-lib.php:2264
587
  msgid "Level 10"
588
  msgstr ""
589
 
590
- #: ../includes/class-ure-lib.php:2265
591
  msgid "Level 9"
592
  msgstr ""
593
 
594
- #: ../includes/class-ure-lib.php:2266
595
  msgid "Level 8"
596
  msgstr ""
597
 
598
- #: ../includes/class-ure-lib.php:2267
599
  msgid "Level 7"
600
  msgstr ""
601
 
602
- #: ../includes/class-ure-lib.php:2268
603
  msgid "Level 6"
604
  msgstr ""
605
 
606
- #: ../includes/class-ure-lib.php:2269
607
  msgid "Level 5"
608
  msgstr ""
609
 
610
- #: ../includes/class-ure-lib.php:2270
611
  msgid "Level 4"
612
  msgstr ""
613
 
614
- #: ../includes/class-ure-lib.php:2271
615
  msgid "Level 3"
616
  msgstr ""
617
 
618
- #: ../includes/class-ure-lib.php:2272
619
  msgid "Level 2"
620
  msgstr ""
621
 
622
- #: ../includes/class-ure-lib.php:2273
623
  msgid "Level 1"
624
  msgstr ""
625
 
626
- #: ../includes/class-ure-lib.php:2274
627
  msgid "Level 0"
628
  msgstr ""
629
 
630
- #: ../includes/class-ure-lib.php:2275
631
  msgid "Edit others pages"
632
  msgstr ""
633
 
634
- #: ../includes/class-ure-lib.php:2276
635
  msgid "Edit published pages"
636
  msgstr ""
637
 
638
- #: ../includes/class-ure-lib.php:2277
639
  msgid "Publish pages"
640
  msgstr ""
641
 
642
- #: ../includes/class-ure-lib.php:2278
643
  msgid "Delete pages"
644
  msgstr ""
645
 
646
- #: ../includes/class-ure-lib.php:2279
647
  msgid "Delete others pages"
648
  msgstr ""
649
 
650
- #: ../includes/class-ure-lib.php:2280
651
  msgid "Delete published pages"
652
  msgstr ""
653
 
654
- #: ../includes/class-ure-lib.php:2281
655
  msgid "Delete posts"
656
  msgstr ""
657
 
658
- #: ../includes/class-ure-lib.php:2282
659
  msgid "Delete others posts"
660
  msgstr ""
661
 
662
- #: ../includes/class-ure-lib.php:2283
663
  msgid "Delete published posts"
664
  msgstr ""
665
 
666
- #: ../includes/class-ure-lib.php:2284
667
  msgid "Delete private posts"
668
  msgstr ""
669
 
670
- #: ../includes/class-ure-lib.php:2285
671
  msgid "Edit private posts"
672
  msgstr ""
673
 
674
- #: ../includes/class-ure-lib.php:2286
675
  msgid "Read private posts"
676
  msgstr ""
677
 
678
- #: ../includes/class-ure-lib.php:2287
679
  msgid "Delete private pages"
680
  msgstr ""
681
 
682
- #: ../includes/class-ure-lib.php:2288
683
  msgid "Edit private pages"
684
  msgstr ""
685
 
686
- #: ../includes/class-ure-lib.php:2289
687
  msgid "Read private pages"
688
  msgstr ""
689
 
690
- #: ../includes/class-ure-lib.php:2290
691
  msgid "Delete users"
692
  msgstr ""
693
 
694
- #: ../includes/class-ure-lib.php:2291
695
  msgid "Create users"
696
  msgstr ""
697
 
698
- #: ../includes/class-ure-lib.php:2292
699
  msgid "Unfiltered upload"
700
  msgstr ""
701
 
702
- #: ../includes/class-ure-lib.php:2293
703
  msgid "Edit dashboard"
704
  msgstr ""
705
 
706
- #: ../includes/class-ure-lib.php:2294
707
  msgid "Update plugins"
708
  msgstr ""
709
 
710
- #: ../includes/class-ure-lib.php:2295
711
  msgid "Delete plugins"
712
  msgstr ""
713
 
714
- #: ../includes/class-ure-lib.php:2296
715
  msgid "Install plugins"
716
  msgstr ""
717
 
718
- #: ../includes/class-ure-lib.php:2297
719
  msgid "Update themes"
720
  msgstr ""
721
 
722
- #: ../includes/class-ure-lib.php:2298
723
  msgid "Install themes"
724
  msgstr ""
725
 
726
- #: ../includes/class-ure-lib.php:2299
727
  msgid "Update core"
728
  msgstr ""
729
 
730
- #: ../includes/class-ure-lib.php:2300
731
  msgid "List users"
732
  msgstr ""
733
 
734
- #: ../includes/class-ure-lib.php:2301
735
  msgid "Remove users"
736
  msgstr ""
737
 
738
- #: ../includes/class-ure-lib.php:2302
739
  msgid "Add users"
740
  msgstr ""
741
 
742
- #: ../includes/class-ure-lib.php:2303
743
  msgid "Promote users"
744
  msgstr ""
745
 
746
- #: ../includes/class-ure-lib.php:2304
747
  msgid "Edit theme options"
748
  msgstr ""
749
 
750
- #: ../includes/class-ure-lib.php:2305
751
  msgid "Delete themes"
752
  msgstr ""
753
 
754
- #: ../includes/class-ure-lib.php:2306
755
  msgid "Export"
756
  msgstr ""
757
 
758
- #: ../includes/class-ure-lib.php:2429
759
  msgid "Error: Capability name must contain latin characters and digits only!"
760
  msgstr ""
761
 
762
- #: ../includes/class-ure-lib.php:2442
763
  #, php-format
764
  msgid "Capability %s is added successfully"
765
  msgstr ""
766
 
767
- #: ../includes/class-ure-lib.php:2444
768
  #, php-format
769
  msgid "Capability %s exists already"
770
  msgstr ""
771
 
772
- #: ../includes/class-ure-lib.php:2473
773
  #, php-format
774
  msgid "Error! You do not have permission to delete this capability: %s!"
775
  msgstr ""
776
 
777
- #: ../includes/class-ure-lib.php:2492
778
  #, php-format
779
  msgid "Capability %s was removed successfully"
780
  msgstr ""
781
 
782
- #: ../includes/class-ure-lib.php:2560
783
  msgid "Version:"
784
  msgstr ""
785
 
786
- #: ../includes/class-ure-lib.php:2561
787
  msgid "Author's website"
788
  msgstr ""
789
 
790
- #: ../includes/class-ure-lib.php:2562
791
  msgid "Plugin webpage"
792
  msgstr ""
793
 
794
- #: ../includes/class-ure-lib.php:2563
795
  msgid "Plugin download"
796
  msgstr ""
797
 
798
- #: ../includes/class-ure-lib.php:2565
 
 
 
 
 
799
  msgid "FAQ"
800
  msgstr ""
801
 
802
- #: ../includes/class-ure-lib.php:2643
803
- msgid "Delete All Unused Roles"
 
804
  msgstr ""
805
 
806
- #: ../includes/class-ure-lib.php:2656
807
- msgid "None"
808
  msgstr ""
809
 
810
- #: ../includes/class-ure-lib.php:2702
811
- msgid "&mdash; No role for this site &mdash;"
812
  msgstr ""
813
 
814
- #: ../includes/class-ure-lib.php:2817
815
- #, php-format
816
- msgid "Denied: %s"
817
  msgstr ""
818
 
819
- #: ../includes/ure-user-edit.php:32
820
- msgid "Network Super Admin"
821
  msgstr ""
822
 
823
- #: ../includes/ure-user-edit.php:35
824
- msgid "Change capabilities for user"
825
  msgstr ""
826
 
827
- #: ../includes/ure-user-edit.php:72
828
- msgid "Primary Role:"
829
  msgstr ""
830
 
831
- #: ../includes/ure-user-edit.php:82
832
- msgid "bbPress Role:"
833
  msgstr ""
834
 
835
- #: ../includes/ure-user-edit.php:92
836
- msgid "Other Roles:"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  msgstr ""
838
 
839
- #: ../includes/class-ure-screen-help.php:12
840
- #: ../includes/class-ure-screen-help.php:41
841
- #: ../includes/class-ure-screen-help.php:60
842
- #: ../includes/class-ure-screen-help.php:79
843
  msgid "User Role Editor Options page help"
844
  msgstr ""
845
 
846
- #: ../includes/class-ure-screen-help.php:16
847
  msgid ""
848
  "turn this option on in order to make the \"Administrator\" role available at "
849
  "the User Role Editor roles selection drop-down list. It is hidden by default "
850
  "for security reasons."
851
  msgstr ""
852
 
853
- #: ../includes/class-ure-screen-help.php:19
854
  msgid ""
855
  "automatically converts capability names from the technical form for internal "
856
  "use like \"edit_others_posts\" to more user friendly form, e.g. \"Edit "
857
  "others posts\"."
858
  msgstr ""
859
 
860
- #: ../includes/class-ure-screen-help.php:22
861
  msgid ""
862
  "Capabilities like \"level_0\", \"level_1\" are deprecated and are not used "
863
  "by WordPress. They are left at the user roles for the compatibility purpose "
@@ -865,25 +908,25 @@ msgid ""
865
  "deprecated capabilities."
866
  msgstr ""
867
 
868
- #: ../includes/class-ure-screen-help.php:26
869
  msgid ""
870
  "If turned off - capabilities section of selected user is shown in readonly "
871
  "mode. Administrator can not assign capabilities to the user directly. He "
872
  "should make it using roles only."
873
  msgstr ""
874
 
875
- #: ../includes/class-ure-screen-help.php:46
876
  msgid ""
877
  "Show at the \"Users\" page a quant of users without role. Module allows to "
878
  "assign all of them an empty role \"No rights\", in order to look on the "
879
  "users list with role \"No rights\" at the separate tab then."
880
  msgstr ""
881
 
882
- #: ../includes/class-ure-screen-help.php:63
883
  msgid "Other default roles for new registered user"
884
  msgstr ""
885
 
886
- #: ../includes/class-ure-screen-help.php:64
887
  msgid ""
888
  "select roles below to assign them to the new user automatically as an "
889
  "addition to the primary role. Note for multisite environment: take into "
@@ -891,11 +934,11 @@ msgid ""
891
  "assigned to the new registered users."
892
  msgstr ""
893
 
894
- #: ../includes/class-ure-screen-help.php:82
895
  msgid "Allow non super-admininstrators to create, edit and delete users"
896
  msgstr ""
897
 
898
- #: ../includes/class-ure-screen-help.php:83
899
  msgid ""
900
  "Super administrator only may create, edit and delete users under WordPress "
901
  "multi-site by default. Turn this option on in order to remove this "
2
  msgstr ""
3
  "Project-Id-Version: User Role Editor 4.19.2\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-07-11 11:50+0700\n"
6
  "PO-Revision-Date: \n"
7
+ "Last-Translator: Vladimir Garagulya <vladimir@shinephp.com>\n"
8
  "Language-Team: https://www.role-editor.com <support@role-editor.com>\n"
9
  "Language: en_EN\n"
10
  "MIME-Version: 1.0\n"
16
  "X-Generator: Poedit 1.5.4\n"
17
  "X-Poedit-SearchPath-0: ..\n"
18
 
19
+ #: ../includes/settings-template.php:17
20
+ msgid "User Role Editor - Options"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  msgstr ""
22
 
 
23
  #: ../includes/settings-template.php:21
24
+ #: ../includes/classes/capabilities-groups-manager.php:71
25
+ #: ../includes/classes/user-role-editor.php:482
26
  msgid "General"
27
  msgstr ""
28
 
 
29
  #: ../includes/settings-template.php:26
30
+ #: ../includes/classes/user-role-editor.php:488
31
  msgid "Additional Modules"
32
  msgstr ""
33
 
 
34
  #: ../includes/settings-template.php:30
35
+ #: ../includes/classes/user-role-editor.php:494
36
  msgid "Default Roles"
37
  msgstr ""
38
 
 
39
  #: ../includes/settings-template.php:34
40
+ #: ../includes/classes/capabilities-groups-manager.php:80
41
+ #: ../includes/classes/user-role-editor.php:500
42
  msgid "Multisite"
43
  msgstr ""
44
 
45
+ #: ../includes/settings-template.php:39
46
+ msgid "About"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  msgstr ""
48
 
49
+ #: ../includes/settings-template.php:53 ../includes/classes/screen-help.php:15
50
+ msgid "Show Administrator role at User Role Editor"
 
 
51
  msgstr ""
52
 
53
+ #: ../includes/settings-template.php:61 ../includes/classes/screen-help.php:18
54
+ msgid "Show capabilities in the human readable form"
55
  msgstr ""
56
 
57
+ #: ../includes/settings-template.php:69 ../includes/classes/role-view.php:350
58
+ #: ../includes/classes/user-view.php:162
59
+ #: ../includes/classes/screen-help.php:21
60
+ msgid "Show deprecated capabilities"
61
  msgstr ""
62
 
63
+ #: ../includes/settings-template.php:77
64
+ msgid "Confirm role update"
65
  msgstr ""
66
 
67
+ #: ../includes/settings-template.php:85 ../includes/classes/screen-help.php:25
68
+ msgid "Edit user capabilities"
69
  msgstr ""
70
 
71
+ #: ../includes/settings-template.php:98 ../includes/settings-template.php:134
72
+ #: ../includes/settings-template.php:166 ../includes/settings-template.php:198
73
+ msgid "Save"
74
  msgstr ""
75
 
76
+ #: ../includes/settings-template.php:119
77
+ #: ../includes/classes/screen-help.php:45
78
+ msgid "Count users without role"
79
  msgstr ""
80
 
81
+ #: ../includes/settings-template.php:146
82
+ msgid "Primary default role: "
83
  msgstr ""
84
 
85
+ #: ../includes/settings-template.php:153
86
+ msgid "Other default roles for new registered user: "
 
 
87
  msgstr ""
88
 
89
+ #: ../includes/settings-template.php:159
90
  msgid ""
91
+ "Note for multisite environment: take into account that other default roles "
92
+ "should exist at the site, in order to be assigned to the new registered "
93
+ "users."
94
  msgstr ""
95
 
96
+ #: ../includes/settings-template.php:185
97
+ msgid "Allow non super administrators to create, edit, and delete users"
98
  msgstr ""
99
 
100
+ #: ../includes/classes/role-view.php:75
101
+ msgid "None"
102
  msgstr ""
103
 
104
+ #: ../includes/classes/role-view.php:108
105
+ msgid "Delete All Unused Roles"
106
  msgstr ""
107
 
108
+ #: ../includes/classes/role-view.php:167 ../includes/classes/role-view.php:178
109
+ msgid "Role name (ID): "
 
 
110
  msgstr ""
111
 
112
+ #: ../includes/classes/role-view.php:169 ../includes/classes/role-view.php:180
113
+ msgid "Display Role Name: "
114
  msgstr ""
115
 
116
+ #: ../includes/classes/role-view.php:171
117
+ msgid "Make copy of: "
 
 
118
  msgstr ""
119
 
120
+ #: ../includes/classes/role-view.php:187
121
+ msgid "Select Role:"
122
  msgstr ""
123
 
124
+ #: ../includes/classes/role-view.php:206
125
+ msgid "Delete:"
126
  msgstr ""
127
 
128
+ #: ../includes/classes/role-view.php:213
129
+ msgid "Capability name (ID): "
130
  msgstr ""
131
 
132
+ #: ../includes/classes/role-view.php:325
133
+ msgid "Select Role and change its capabilities:"
134
  msgstr ""
135
 
136
+ #: ../includes/classes/role-view.php:339 ../includes/classes/user-view.php:152
137
+ msgid "Show capabilities in human readable form"
 
138
  msgstr ""
139
 
140
+ #: ../includes/classes/role-view.php:354
141
+ msgid "If checked, then apply action to ALL sites of this Network"
 
142
  msgstr ""
143
 
144
+ #: ../includes/classes/role-view.php:366
145
+ msgid "Apply to All Sites"
146
  msgstr ""
147
 
148
+ #: ../includes/classes/user-view.php:61
149
+ msgid "Switch&nbsp;To"
 
150
  msgstr ""
151
 
152
+ #: ../includes/classes/user-view.php:73
153
+ msgid "Network Super Admin"
 
154
  msgstr ""
155
 
156
+ #: ../includes/classes/user-view.php:98
157
+ msgid "&mdash; No role for this site &mdash;"
 
158
  msgstr ""
159
 
160
+ #: ../includes/classes/user-view.php:135
161
+ msgid "Change capabilities for user"
162
  msgstr ""
163
 
164
+ #: ../includes/classes/user-view.php:170
165
+ msgid "Primary Role:"
166
  msgstr ""
167
 
168
+ #: ../includes/classes/user-view.php:176
169
+ msgid "bbPress Role:"
 
 
 
170
  msgstr ""
171
 
172
+ #: ../includes/classes/user-view.php:185
173
+ msgid "Other Roles:"
174
  msgstr ""
175
 
176
+ #: ../includes/classes/user-other-roles.php:81
177
+ #: ../includes/classes/user-other-roles.php:182
 
178
  msgid "Other Roles"
179
  msgstr ""
180
 
181
+ #: ../includes/classes/user-other-roles.php:82
182
  msgid "Select additional roles for this user"
183
  msgstr ""
184
 
185
+ #: ../includes/classes/user-other-roles.php:161
186
+ #: ../includes/classes/user-role-editor.php:355
187
+ msgid "Capabilities"
188
+ msgstr ""
189
+
190
+ #: ../includes/classes/user-other-roles.php:168
191
  msgid "Edit"
192
  msgstr ""
193
 
194
+ #: ../includes/classes/user-other-roles.php:218
195
  msgid "Additional Capabilities"
196
  msgstr ""
197
 
198
+ #: ../includes/classes/ure-lib.php:292
199
  msgid "Error: wrong request"
200
  msgstr ""
201
 
202
+ #: ../includes/classes/ure-lib.php:317
203
+ #: ../includes/classes/user-role-editor.php:510
204
+ #: ../includes/classes/user-role-editor.php:541
205
+ msgid "User Role Editor"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  msgstr ""
207
 
208
+ #: ../includes/classes/ure-lib.php:381
209
  msgid "Error: "
210
  msgstr ""
211
 
212
+ #: ../includes/classes/ure-lib.php:381
213
  msgid "Role"
214
  msgstr ""
215
 
216
+ #: ../includes/classes/ure-lib.php:382
217
  msgid "does not exist"
218
  msgstr ""
219
 
220
+ #: ../includes/classes/ure-lib.php:425
221
  msgid "Role is updated successfully"
222
  msgstr ""
223
 
224
+ #: ../includes/classes/ure-lib.php:427
225
  msgid "Roles are updated for all network"
226
  msgstr ""
227
 
228
+ #: ../includes/classes/ure-lib.php:433
229
  msgid "Error occured during role(s) update"
230
  msgstr ""
231
 
232
+ #: ../includes/classes/ure-lib.php:440
233
  msgid "User capabilities are updated successfully"
234
  msgstr ""
235
 
236
+ #: ../includes/classes/ure-lib.php:445
237
  msgid "Error occured during user update"
238
  msgstr ""
239
 
240
+ #: ../includes/classes/ure-lib.php:503
241
  msgid "User Roles are restored to WordPress default values. "
242
  msgstr ""
243
 
244
+ #: ../includes/classes/ure-lib.php:1040
245
  msgid "read about"
246
  msgstr ""
247
 
248
+ #: ../includes/classes/ure-lib.php:1041
249
  msgid "user capability"
250
  msgstr ""
251
 
252
+ #: ../includes/classes/ure-lib.php:1042
253
  msgid "Help"
254
  msgstr ""
255
 
256
+ #: ../includes/classes/ure-lib.php:1374 ../includes/classes/ure-lib.php:1650
257
+ #: ../includes/classes/ure-lib.php:1766 ../includes/classes/ure-lib.php:1814
258
+ #: ../includes/classes/ure-lib.php:2093 ../includes/classes/ure-lib.php:2136
259
+ #: ../includes/classes/user-role-editor.php:751
260
+ msgid "Insufficient permissions to work with User Role Editor"
261
+ msgstr ""
262
+
263
+ #: ../includes/classes/ure-lib.php:1613
264
  msgid "Error is occur. Please check the log file."
265
  msgstr ""
266
 
267
+ #: ../includes/classes/ure-lib.php:1659 ../includes/classes/ure-lib.php:1726
268
  msgid ""
269
  "Error: Role ID must contain latin characters, digits, hyphens or underscore "
270
  "only!"
271
  msgstr ""
272
 
273
+ #: ../includes/classes/ure-lib.php:1663 ../includes/classes/ure-lib.php:1730
274
  msgid ""
275
  "Error: WordPress does not support numeric Role name (ID). Add latin "
276
  "characters to it."
277
  msgstr ""
278
 
279
+ #: ../includes/classes/ure-lib.php:1678
280
  #, php-format
281
  msgid "Role %s exists already"
282
  msgstr ""
283
 
284
+ #: ../includes/classes/ure-lib.php:1693
285
  msgid "Error is encountered during new role create operation"
286
  msgstr ""
287
 
288
+ #: ../includes/classes/ure-lib.php:1695
289
  #, php-format
290
  msgid "Role %s is created successfully"
291
  msgstr ""
292
 
293
+ #: ../includes/classes/ure-lib.php:1719
294
  msgid "Error: Role ID is empty!"
295
  msgstr ""
296
 
297
+ #: ../includes/classes/ure-lib.php:1737
298
  msgid "Error: Empty role display name is not allowed."
299
  msgstr ""
300
 
301
+ #: ../includes/classes/ure-lib.php:1744
302
  #, php-format
303
  msgid "Role %s does not exists"
304
  msgstr ""
305
 
306
+ #: ../includes/classes/ure-lib.php:1752
307
  #, php-format
308
  msgid "Role %s is renamed to %s successfully"
309
  msgstr ""
310
 
311
+ #: ../includes/classes/ure-lib.php:1825
312
  msgid "Error encountered during role delete operation"
313
  msgstr ""
314
 
315
+ #: ../includes/classes/ure-lib.php:1827
316
  msgid "Unused roles are deleted successfully"
317
  msgstr ""
318
 
319
+ #: ../includes/classes/ure-lib.php:1829
320
  #, php-format
321
  msgid "Role %s is deleted successfully"
322
  msgstr ""
323
 
324
+ #: ../includes/classes/ure-lib.php:1860
325
  msgid "Error encountered during default role change operation"
326
  msgstr ""
327
 
328
+ #: ../includes/classes/ure-lib.php:1863
329
  #, php-format
330
  msgid "Default role for new users is set to %s successfully"
331
  msgstr ""
332
 
333
+ #: ../includes/classes/ure-lib.php:1866
334
  msgid "Can not set Administrator role as a default one"
335
  msgstr ""
336
 
337
+ #: ../includes/classes/ure-lib.php:1868
338
  msgid "This role does not exist - "
339
  msgstr ""
340
 
341
+ #: ../includes/classes/ure-lib.php:1884
342
  msgid "Editor"
343
  msgstr ""
344
 
345
+ #: ../includes/classes/ure-lib.php:1885
346
  msgid "Author"
347
  msgstr ""
348
 
349
+ #: ../includes/classes/ure-lib.php:1886
350
  msgid "Contributor"
351
  msgstr ""
352
 
353
+ #: ../includes/classes/ure-lib.php:1887
354
  msgid "Subscriber"
355
  msgstr ""
356
 
357
+ #: ../includes/classes/ure-lib.php:1889
358
  msgid "Switch themes"
359
  msgstr ""
360
 
361
+ #: ../includes/classes/ure-lib.php:1890
362
  msgid "Edit themes"
363
  msgstr ""
364
 
365
+ #: ../includes/classes/ure-lib.php:1891
366
  msgid "Activate plugins"
367
  msgstr ""
368
 
369
+ #: ../includes/classes/ure-lib.php:1892
370
  msgid "Edit plugins"
371
  msgstr ""
372
 
373
+ #: ../includes/classes/ure-lib.php:1893
374
  msgid "Edit users"
375
  msgstr ""
376
 
377
+ #: ../includes/classes/ure-lib.php:1894
378
  msgid "Edit files"
379
  msgstr ""
380
 
381
+ #: ../includes/classes/ure-lib.php:1895
382
  msgid "Manage options"
383
  msgstr ""
384
 
385
+ #: ../includes/classes/ure-lib.php:1896
386
  msgid "Moderate comments"
387
  msgstr ""
388
 
389
+ #: ../includes/classes/ure-lib.php:1897
390
  msgid "Manage categories"
391
  msgstr ""
392
 
393
+ #: ../includes/classes/ure-lib.php:1898
394
  msgid "Manage links"
395
  msgstr ""
396
 
397
+ #: ../includes/classes/ure-lib.php:1899
398
  msgid "Upload files"
399
  msgstr ""
400
 
401
+ #: ../includes/classes/ure-lib.php:1900
402
  msgid "Import"
403
  msgstr ""
404
 
405
+ #: ../includes/classes/ure-lib.php:1901
406
  msgid "Unfiltered html"
407
  msgstr ""
408
 
409
+ #: ../includes/classes/ure-lib.php:1902
410
  msgid "Edit posts"
411
  msgstr ""
412
 
413
+ #: ../includes/classes/ure-lib.php:1903
414
  msgid "Edit others posts"
415
  msgstr ""
416
 
417
+ #: ../includes/classes/ure-lib.php:1904
418
  msgid "Edit published posts"
419
  msgstr ""
420
 
421
+ #: ../includes/classes/ure-lib.php:1905
422
  msgid "Publish posts"
423
  msgstr ""
424
 
425
+ #: ../includes/classes/ure-lib.php:1906
426
  msgid "Edit pages"
427
  msgstr ""
428
 
429
+ #: ../includes/classes/ure-lib.php:1907
430
  msgid "Read"
431
  msgstr ""
432
 
433
+ #: ../includes/classes/ure-lib.php:1908
434
  msgid "Level 10"
435
  msgstr ""
436
 
437
+ #: ../includes/classes/ure-lib.php:1909
438
  msgid "Level 9"
439
  msgstr ""
440
 
441
+ #: ../includes/classes/ure-lib.php:1910
442
  msgid "Level 8"
443
  msgstr ""
444
 
445
+ #: ../includes/classes/ure-lib.php:1911
446
  msgid "Level 7"
447
  msgstr ""
448
 
449
+ #: ../includes/classes/ure-lib.php:1912
450
  msgid "Level 6"
451
  msgstr ""
452
 
453
+ #: ../includes/classes/ure-lib.php:1913
454
  msgid "Level 5"
455
  msgstr ""
456
 
457
+ #: ../includes/classes/ure-lib.php:1914
458
  msgid "Level 4"
459
  msgstr ""
460
 
461
+ #: ../includes/classes/ure-lib.php:1915
462
  msgid "Level 3"
463
  msgstr ""
464
 
465
+ #: ../includes/classes/ure-lib.php:1916
466
  msgid "Level 2"
467
  msgstr ""
468
 
469
+ #: ../includes/classes/ure-lib.php:1917
470
  msgid "Level 1"
471
  msgstr ""
472
 
473
+ #: ../includes/classes/ure-lib.php:1918
474
  msgid "Level 0"
475
  msgstr ""
476
 
477
+ #: ../includes/classes/ure-lib.php:1919
478
  msgid "Edit others pages"
479
  msgstr ""
480
 
481
+ #: ../includes/classes/ure-lib.php:1920
482
  msgid "Edit published pages"
483
  msgstr ""
484
 
485
+ #: ../includes/classes/ure-lib.php:1921
486
  msgid "Publish pages"
487
  msgstr ""
488
 
489
+ #: ../includes/classes/ure-lib.php:1922
490
  msgid "Delete pages"
491
  msgstr ""
492
 
493
+ #: ../includes/classes/ure-lib.php:1923
494
  msgid "Delete others pages"
495
  msgstr ""
496
 
497
+ #: ../includes/classes/ure-lib.php:1924
498
  msgid "Delete published pages"
499
  msgstr ""
500
 
501
+ #: ../includes/classes/ure-lib.php:1925
502
  msgid "Delete posts"
503
  msgstr ""
504
 
505
+ #: ../includes/classes/ure-lib.php:1926
506
  msgid "Delete others posts"
507
  msgstr ""
508
 
509
+ #: ../includes/classes/ure-lib.php:1927
510
  msgid "Delete published posts"
511
  msgstr ""
512
 
513
+ #: ../includes/classes/ure-lib.php:1928
514
  msgid "Delete private posts"
515
  msgstr ""
516
 
517
+ #: ../includes/classes/ure-lib.php:1929
518
  msgid "Edit private posts"
519
  msgstr ""
520
 
521
+ #: ../includes/classes/ure-lib.php:1930
522
  msgid "Read private posts"
523
  msgstr ""
524
 
525
+ #: ../includes/classes/ure-lib.php:1931
526
  msgid "Delete private pages"
527
  msgstr ""
528
 
529
+ #: ../includes/classes/ure-lib.php:1932
530
  msgid "Edit private pages"
531
  msgstr ""
532
 
533
+ #: ../includes/classes/ure-lib.php:1933
534
  msgid "Read private pages"
535
  msgstr ""
536
 
537
+ #: ../includes/classes/ure-lib.php:1934
538
  msgid "Delete users"
539
  msgstr ""
540
 
541
+ #: ../includes/classes/ure-lib.php:1935
542
  msgid "Create users"
543
  msgstr ""
544
 
545
+ #: ../includes/classes/ure-lib.php:1936
546
  msgid "Unfiltered upload"
547
  msgstr ""
548
 
549
+ #: ../includes/classes/ure-lib.php:1937
550
  msgid "Edit dashboard"
551
  msgstr ""
552
 
553
+ #: ../includes/classes/ure-lib.php:1938
554
  msgid "Update plugins"
555
  msgstr ""
556
 
557
+ #: ../includes/classes/ure-lib.php:1939
558
  msgid "Delete plugins"
559
  msgstr ""
560
 
561
+ #: ../includes/classes/ure-lib.php:1940
562
  msgid "Install plugins"
563
  msgstr ""
564
 
565
+ #: ../includes/classes/ure-lib.php:1941
566
  msgid "Update themes"
567
  msgstr ""
568
 
569
+ #: ../includes/classes/ure-lib.php:1942
570
  msgid "Install themes"
571
  msgstr ""
572
 
573
+ #: ../includes/classes/ure-lib.php:1943
574
  msgid "Update core"
575
  msgstr ""
576
 
577
+ #: ../includes/classes/ure-lib.php:1944
578
  msgid "List users"
579
  msgstr ""
580
 
581
+ #: ../includes/classes/ure-lib.php:1945
582
  msgid "Remove users"
583
  msgstr ""
584
 
585
+ #: ../includes/classes/ure-lib.php:1946
586
  msgid "Add users"
587
  msgstr ""
588
 
589
+ #: ../includes/classes/ure-lib.php:1947
590
  msgid "Promote users"
591
  msgstr ""
592
 
593
+ #: ../includes/classes/ure-lib.php:1948
594
  msgid "Edit theme options"
595
  msgstr ""
596
 
597
+ #: ../includes/classes/ure-lib.php:1949
598
  msgid "Delete themes"
599
  msgstr ""
600
 
601
+ #: ../includes/classes/ure-lib.php:1950
602
  msgid "Export"
603
  msgstr ""
604
 
605
+ #: ../includes/classes/ure-lib.php:2104
606
  msgid "Error: Capability name must contain latin characters and digits only!"
607
  msgstr ""
608
 
609
+ #: ../includes/classes/ure-lib.php:2114
610
  #, php-format
611
  msgid "Capability %s is added successfully"
612
  msgstr ""
613
 
614
+ #: ../includes/classes/ure-lib.php:2116
615
  #, php-format
616
  msgid "Capability %s exists already"
617
  msgstr ""
618
 
619
+ #: ../includes/classes/ure-lib.php:2143
620
  #, php-format
621
  msgid "Error! You do not have permission to delete this capability: %s!"
622
  msgstr ""
623
 
624
+ #: ../includes/classes/ure-lib.php:2162
625
  #, php-format
626
  msgid "Capability %s was removed successfully"
627
  msgstr ""
628
 
629
+ #: ../includes/classes/ure-lib.php:2202
630
  msgid "Version:"
631
  msgstr ""
632
 
633
+ #: ../includes/classes/ure-lib.php:2203
634
  msgid "Author's website"
635
  msgstr ""
636
 
637
+ #: ../includes/classes/ure-lib.php:2204
638
  msgid "Plugin webpage"
639
  msgstr ""
640
 
641
+ #: ../includes/classes/ure-lib.php:2205
642
  msgid "Plugin download"
643
  msgstr ""
644
 
645
+ #: ../includes/classes/ure-lib.php:2206
646
+ #: ../includes/classes/user-role-editor.php:459
647
+ msgid "Changelog"
648
+ msgstr ""
649
+
650
+ #: ../includes/classes/ure-lib.php:2207
651
  msgid "FAQ"
652
  msgstr ""
653
 
654
+ #: ../includes/classes/ure-lib.php:2352
655
+ #, php-format
656
+ msgid "Denied: %s"
657
  msgstr ""
658
 
659
+ #: ../includes/classes/capabilities-groups-manager.php:40
660
+ msgid "Custom Post Types"
661
  msgstr ""
662
 
663
+ #: ../includes/classes/capabilities-groups-manager.php:69
664
+ msgid "All"
665
  msgstr ""
666
 
667
+ #: ../includes/classes/capabilities-groups-manager.php:70
668
+ msgid "Core"
 
669
  msgstr ""
670
 
671
+ #: ../includes/classes/capabilities-groups-manager.php:72
672
+ msgid "Themes"
673
  msgstr ""
674
 
675
+ #: ../includes/classes/capabilities-groups-manager.php:73
676
+ msgid "Posts"
677
  msgstr ""
678
 
679
+ #: ../includes/classes/capabilities-groups-manager.php:74
680
+ msgid "Pages"
681
  msgstr ""
682
 
683
+ #: ../includes/classes/capabilities-groups-manager.php:75
684
+ msgid "Plugins"
685
  msgstr ""
686
 
687
+ #: ../includes/classes/capabilities-groups-manager.php:76
688
+ msgid "Users"
689
+ msgstr ""
690
+
691
+ #: ../includes/classes/capabilities-groups-manager.php:82
692
+ msgid "Deprecated"
693
+ msgstr ""
694
+
695
+ #: ../includes/classes/capabilities-groups-manager.php:87
696
+ msgid "Custom capabilities"
697
+ msgstr ""
698
+
699
+ #: ../includes/classes/user-role-editor.php:254
700
+ msgid "Change role for users without role"
701
+ msgstr ""
702
+
703
+ #: ../includes/classes/user-role-editor.php:255
704
+ msgid "To:"
705
+ msgstr ""
706
+
707
+ #: ../includes/classes/user-role-editor.php:256
708
+ msgid "No rights"
709
+ msgstr ""
710
+
711
+ #: ../includes/classes/user-role-editor.php:257
712
+ msgid "Provide new role"
713
+ msgstr ""
714
+
715
+ #: ../includes/classes/user-role-editor.php:329
716
+ #: ../includes/classes/user-role-editor.php:331
717
+ msgid "You do not have permission to edit this user."
718
+ msgstr ""
719
+
720
+ #: ../includes/classes/user-role-editor.php:448
721
+ msgid "Settings"
722
+ msgstr ""
723
+
724
+ #: ../includes/classes/user-role-editor.php:604
725
+ #: ../includes/classes/user-role-editor.php:622
726
+ #: ../includes/classes/user-role-editor.php:667
727
+ msgid "User Role Editor options are updated"
728
+ msgstr ""
729
+
730
+ #: ../includes/classes/user-role-editor.php:650
731
+ msgid "Default Roles are updated"
732
+ msgstr ""
733
+
734
+ #: ../includes/classes/user-role-editor.php:676
735
+ msgid ""
736
+ "You do not have sufficient permissions to manage options for User Role "
737
+ "Editor."
738
+ msgstr ""
739
+
740
+ #: ../includes/classes/user-role-editor.php:789
741
+ msgid "Confirm"
742
+ msgstr ""
743
+
744
+ #: ../includes/classes/user-role-editor.php:790
745
+ msgid "Yes"
746
+ msgstr ""
747
+
748
+ #: ../includes/classes/user-role-editor.php:791
749
+ msgid "No"
750
+ msgstr ""
751
+
752
+ #: ../includes/classes/user-role-editor.php:792
753
+ msgid "Select All"
754
+ msgstr ""
755
+
756
+ #: ../includes/classes/user-role-editor.php:793
757
+ msgid "Unselect All"
758
+ msgstr ""
759
+
760
+ #: ../includes/classes/user-role-editor.php:794
761
+ msgid "Reverse"
762
+ msgstr ""
763
+
764
+ #: ../includes/classes/user-role-editor.php:795
765
+ msgid "Update"
766
+ msgstr ""
767
+
768
+ #: ../includes/classes/user-role-editor.php:796
769
+ msgid "Please confirm permissions update"
770
+ msgstr ""
771
+
772
+ #: ../includes/classes/user-role-editor.php:797
773
+ msgid "Add New Role"
774
+ msgstr ""
775
+
776
+ #: ../includes/classes/user-role-editor.php:798
777
+ #: ../includes/classes/user-role-editor.php:803
778
+ msgid "Rename Role"
779
+ msgstr ""
780
+
781
+ #: ../includes/classes/user-role-editor.php:799
782
+ msgid " Role name (ID) can not be empty!"
783
+ msgstr ""
784
+
785
+ #: ../includes/classes/user-role-editor.php:800
786
+ msgid ""
787
+ " Role name (ID) must contain latin characters, digits, hyphens or underscore "
788
+ "only!"
789
+ msgstr ""
790
+
791
+ #: ../includes/classes/user-role-editor.php:801
792
+ msgid ""
793
+ " WordPress does not support numeric Role name (ID). Add latin characters to "
794
+ "it."
795
+ msgstr ""
796
+
797
+ #: ../includes/classes/user-role-editor.php:802
798
+ msgid "Add Role"
799
+ msgstr ""
800
+
801
+ #: ../includes/classes/user-role-editor.php:804
802
+ msgid "Delete Role"
803
+ msgstr ""
804
+
805
+ #: ../includes/classes/user-role-editor.php:805
806
+ msgid "Cancel"
807
+ msgstr ""
808
+
809
+ #: ../includes/classes/user-role-editor.php:806
810
+ msgid "Add Capability"
811
+ msgstr ""
812
+
813
+ #: ../includes/classes/user-role-editor.php:807
814
+ #: ../includes/classes/user-role-editor.php:816
815
+ msgid "Delete Capability"
816
+ msgstr ""
817
+
818
+ #: ../includes/classes/user-role-editor.php:808
819
+ msgid "Reset"
820
+ msgstr ""
821
+
822
+ #: ../includes/classes/user-role-editor.php:809
823
+ msgid "DANGER! Resetting will restore default settings from WordPress Core."
824
+ msgstr ""
825
+
826
+ #: ../includes/classes/user-role-editor.php:810
827
+ msgid ""
828
+ "If any plugins have changed capabilities in any way upon installation (such "
829
+ "as S2Member, WooCommerce, and many more), those capabilities will be DELETED!"
830
+ msgstr ""
831
+
832
+ #: ../includes/classes/user-role-editor.php:811
833
+ msgid ""
834
+ "For more information on how to undo changes and restore plugin capabilities "
835
+ "go to"
836
+ msgstr ""
837
+
838
+ #: ../includes/classes/user-role-editor.php:813
839
+ msgid "Continue?"
840
+ msgstr ""
841
+
842
+ #: ../includes/classes/user-role-editor.php:814
843
+ msgid "Default Role"
844
+ msgstr ""
845
+
846
+ #: ../includes/classes/user-role-editor.php:815
847
+ msgid "Set New Default Role"
848
+ msgstr ""
849
+
850
+ #: ../includes/classes/user-role-editor.php:817
851
+ msgid ""
852
+ "Warning! Be careful - removing critical capability could crash some plugin "
853
+ "or other custom code"
854
+ msgstr ""
855
+
856
+ #: ../includes/classes/user-role-editor.php:818
857
+ msgid " Capability name (ID) can not be empty!"
858
+ msgstr ""
859
+
860
+ #: ../includes/classes/user-role-editor.php:819
861
+ msgid ""
862
+ " Capability name (ID) must contain latin characters, digits, hyphens or "
863
+ "underscore only!"
864
+ msgstr ""
865
+
866
+ #: ../includes/classes/role-additional-options.php:69
867
+ msgid "Hide admin bar"
868
+ msgstr ""
869
+
870
+ #: ../includes/classes/role-additional-options.php:121
871
+ msgid "Additional Options"
872
+ msgstr ""
873
+
874
+ #: ../includes/classes/view.php:247
875
+ msgid "Group"
876
+ msgstr ""
877
+
878
+ #: ../includes/classes/view.php:252
879
+ msgid "Quick filter:"
880
  msgstr ""
881
 
882
+ #: ../includes/classes/screen-help.php:12
883
+ #: ../includes/classes/screen-help.php:41
884
+ #: ../includes/classes/screen-help.php:60
885
+ #: ../includes/classes/screen-help.php:79
886
  msgid "User Role Editor Options page help"
887
  msgstr ""
888
 
889
+ #: ../includes/classes/screen-help.php:16
890
  msgid ""
891
  "turn this option on in order to make the \"Administrator\" role available at "
892
  "the User Role Editor roles selection drop-down list. It is hidden by default "
893
  "for security reasons."
894
  msgstr ""
895
 
896
+ #: ../includes/classes/screen-help.php:19
897
  msgid ""
898
  "automatically converts capability names from the technical form for internal "
899
  "use like \"edit_others_posts\" to more user friendly form, e.g. \"Edit "
900
  "others posts\"."
901
  msgstr ""
902
 
903
+ #: ../includes/classes/screen-help.php:22
904
  msgid ""
905
  "Capabilities like \"level_0\", \"level_1\" are deprecated and are not used "
906
  "by WordPress. They are left at the user roles for the compatibility purpose "
908
  "deprecated capabilities."
909
  msgstr ""
910
 
911
+ #: ../includes/classes/screen-help.php:26
912
  msgid ""
913
  "If turned off - capabilities section of selected user is shown in readonly "
914
  "mode. Administrator can not assign capabilities to the user directly. He "
915
  "should make it using roles only."
916
  msgstr ""
917
 
918
+ #: ../includes/classes/screen-help.php:46
919
  msgid ""
920
  "Show at the \"Users\" page a quant of users without role. Module allows to "
921
  "assign all of them an empty role \"No rights\", in order to look on the "
922
  "users list with role \"No rights\" at the separate tab then."
923
  msgstr ""
924
 
925
+ #: ../includes/classes/screen-help.php:63
926
  msgid "Other default roles for new registered user"
927
  msgstr ""
928
 
929
+ #: ../includes/classes/screen-help.php:64
930
  msgid ""
931
  "select roles below to assign them to the new user automatically as an "
932
  "addition to the primary role. Note for multisite environment: take into "
934
  "assigned to the new registered users."
935
  msgstr ""
936
 
937
+ #: ../includes/classes/screen-help.php:82
938
  msgid "Allow non super-admininstrators to create, edit and delete users"
939
  msgstr ""
940
 
941
+ #: ../includes/classes/screen-help.php:83
942
  msgid ""
943
  "Super administrator only may create, edit and delete users under WordPress "
944
  "multi-site by default. Turn this option on in order to remove this "
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: shinephp
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladimir%40shinephp%2ecom&lc=RU&item_name=ShinePHP%2ecom&item_number=User%20Role%20Editor%20WordPress%20plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
- Tested up to: 4.5.1
7
- Stable tag: 4.25.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,14 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
 
 
80
  = [4.25.2] 03.05.2016 =
81
  * Update: Enhanced inner processing of available custom post types list.
82
  * Update: Uses 15 seconds transient cache in order to not count users without role twice when 'restrict_manage_users' action fires.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladimir%40shinephp%2ecom&lc=RU&item_name=ShinePHP%2ecom&item_number=User%20Role%20Editor%20WordPress%20plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
+ Tested up to: 4.5.3
7
+ Stable tag: 4.26
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
77
 
78
  == Changelog ==
79
 
80
+ = [4.26] 14.07.2016 =
81
+ * New: User capabilities were groupd by functionality for more convenience.
82
+ * Update: URE_KEY_CAPABILITY constant was changed from 'ure_edit_roles' to 'ure_manage_options'. To make possible for non-admin users access to the User Role Editor without access to the 'administrator' role and users with 'administrator' role.
83
+ * Update: User receives full access to User Role Editor under WordPress multisite if he has 'manage_network_plugins' capability instead of 'manager_network_users' as earlier. This allows to give user ability to edit network users without giving him access to the User Role Editor.
84
+ * Update: Multisite: use WordPress's global $current_site->blog_id to define main blog ID instead of selecting the 1st one from the sorted list of blogs.
85
+ * Update: use WP transients at URE_Lib::_get_post_types() to reduce response time.
86
+ * Update: various internal optimizations.
87
+
88
  = [4.25.2] 03.05.2016 =
89
  * Update: Enhanced inner processing of available custom post types list.
90
  * Update: Uses 15 seconds transient cache in order to not count users without role twice when 'restrict_manage_users' action fires.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
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.25.2
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: ure
@@ -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.25.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.26
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: ure
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.26');
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__));