User Role Editor - Version 4.19.3

Version Description

Download this release

Release Info

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

Code changes from version 4.19.2 to 4.19.3

css/ure-admin.css CHANGED
@@ -68,6 +68,11 @@ input.warning:hover, a.warning:hover {
68
  white-space: nowrap;
69
  }
70
 
 
 
 
 
 
71
  .ure-sidebar {
72
  float: right;
73
  }
68
  white-space: nowrap;
69
  }
70
 
71
+ #ure_container {
72
+ float: left;
73
+ width: 100%;
74
+ }
75
+
76
  .ure-sidebar {
77
  float: right;
78
  }
includes/class-advertisement.php CHANGED
@@ -17,15 +17,17 @@ class ure_Advertisement {
17
  $used = array(-1);
18
  $index = $this->rand_unique( $used );
19
  $this->slots[$index] = $this->admin_menu_editor();
20
-
21
  $used[] = $index;
22
- $index = $this->rand_unique( $used );
23
- $this->slots[$index] = $this->manage_wp();
24
 
25
- $used[] = $index;
 
 
 
 
 
26
  $index = $this->rand_unique( $used );
27
  $this->slots[$index] = $this->wp_esignature();
28
-
29
 
30
  }
31
  // end of __construct
17
  $used = array(-1);
18
  $index = $this->rand_unique( $used );
19
  $this->slots[$index] = $this->admin_menu_editor();
 
20
  $used[] = $index;
 
 
21
 
22
+ if ( date('Y-m-d') < date('Y-m-d', strtotime('2015-11-03')) ) {
23
+ $index = $this->rand_unique( $used );
24
+ $this->slots[$index] = $this->manage_wp();
25
+ $used[] = $index;
26
+ }
27
+
28
  $index = $this->rand_unique( $used );
29
  $this->slots[$index] = $this->wp_esignature();
30
+ $used[] = $index;
31
 
32
  }
33
  // end of __construct
includes/class-ure-lib.php CHANGED
@@ -34,7 +34,14 @@ class Ure_Lib extends Garvs_WP_Lib {
34
  protected $role_delete_html = '';
35
  protected $capability_remove_html = '';
36
  protected $advert = null;
 
 
 
 
 
 
37
  public $debug = false;
 
38
 
39
 
40
  /** class constructor
@@ -331,13 +338,14 @@ class Ure_Lib extends Garvs_WP_Lib {
331
 
332
 
333
  protected function show_editor() {
 
334
 
335
  $this->show_message($this->notification);
336
  ?>
337
  <div class="wrap">
338
  <div id="ure-icon" class="icon32"><br/></div>
339
  <h2><?php _e('User Role Editor', 'user-role-editor'); ?></h2>
340
- <div id="poststuff">
341
  <div class="ure-sidebar" >
342
  <?php
343
  $this->advertisement();
@@ -1599,6 +1607,8 @@ class Ure_Lib extends Garvs_WP_Lib {
1599
 
1600
  protected function add_custom_post_type_caps() {
1601
 
 
 
1602
  $capabilities = array(
1603
  'create_posts',
1604
  'edit_posts',
@@ -1612,21 +1622,37 @@ class Ure_Lib extends Garvs_WP_Lib {
1612
  'delete_published_posts',
1613
  'delete_others_posts'
1614
  );
1615
- $post_types = get_post_types(array('public'=>true, 'show_ui'=>true, '_builtin'=>false), 'objects');
1616
- foreach($post_types as $post_type) {
1617
- if ($post_type->capability_type=='post') {
1618
- continue;
1619
- }
1620
  if (!isset($post_type->cap)) {
1621
  continue;
1622
  }
1623
  foreach($capabilities as $capability) {
1624
  if (isset($post_type->cap->$capability)) {
1625
- $this->add_capability_to_full_caps_list($post_type->cap->$capability);
 
 
 
 
 
 
 
1626
  }
1627
  }
1628
  }
1629
 
 
 
 
 
 
 
 
 
 
 
 
 
1630
  }
1631
  // end of add_custom_post_type_caps()
1632
 
34
  protected $role_delete_html = '';
35
  protected $capability_remove_html = '';
36
  protected $advert = null;
37
+
38
+ // when allow_edit_users_to_not_super_admin option is turned ON, we set this property to true
39
+ // when we raise single site admin permissions up to the superadmin for the 'Add new user' new-user.php page
40
+ // User_Role_Editor::allow_add_user_as_superadmin()
41
+ public $raised_permissions = false;
42
+
43
  public $debug = false;
44
+
45
 
46
 
47
  /** class constructor
338
 
339
 
340
  protected function show_editor() {
341
+ $container_width = ($this->ure_object == 'user') ? 1400 : 1200;
342
 
343
  $this->show_message($this->notification);
344
  ?>
345
  <div class="wrap">
346
  <div id="ure-icon" class="icon32"><br/></div>
347
  <h2><?php _e('User Role Editor', 'user-role-editor'); ?></h2>
348
+ <div id="ure_container" style="min-width: <?php echo $container_width;?>px;">
349
  <div class="ure-sidebar" >
350
  <?php
351
  $this->advertisement();
1607
 
1608
  protected function add_custom_post_type_caps() {
1609
 
1610
+ global $wp_roles;
1611
+
1612
  $capabilities = array(
1613
  'create_posts',
1614
  'edit_posts',
1622
  'delete_published_posts',
1623
  'delete_others_posts'
1624
  );
1625
+ $post_types = get_post_types(array('_builtin'=>false), 'objects');
1626
+ foreach($post_types as $post_type) {
 
 
 
1627
  if (!isset($post_type->cap)) {
1628
  continue;
1629
  }
1630
  foreach($capabilities as $capability) {
1631
  if (isset($post_type->cap->$capability)) {
1632
+ $cap_to_check = $post_type->cap->$capability;
1633
+ $this->add_capability_to_full_caps_list($cap_to_check);
1634
+ if (!$this->multisite &&
1635
+ isset($wp_roles->role_objects['administrator']) &&
1636
+ !isset($wp_roles->role_objects['administrator']->capabilities[$cap_to_check])) {
1637
+ // admin should be capable to edit any posts
1638
+ $wp_roles->role_objects['administrator']->add_cap($cap_to_check, true);
1639
+ }
1640
  }
1641
  }
1642
  }
1643
 
1644
+ if (!$this->multisite && isset($wp_roles->role_objects['administrator'])) {
1645
+ foreach(array('post', 'page') as $post_type_name) {
1646
+ $post_type = get_post_type_object($post_type_name);
1647
+ if ($post_type->cap->create_posts!=='edit_'. $post_type->name .'s') { // 'create' capability is active
1648
+ if (!isset($wp_roles->role_objects['administrator']->capabilities[$post_type->cap->create_posts])) {
1649
+ // admin should be capable to create posts and pages
1650
+ $wp_roles->role_objects['administrator']->add_cap($post_type->cap->create_posts, true);
1651
+ }
1652
+ }
1653
+ } // foreach()
1654
+ } // if ()
1655
+
1656
  }
1657
  // end of add_custom_post_type_caps()
1658
 
includes/class-user-role-editor.php CHANGED
@@ -159,6 +159,8 @@ class User_Role_Editor {
159
 
160
  global $pagenow, $current_user;
161
 
 
 
162
  if ($pagenow!=='user-new.php') {
163
  return $site_admins;
164
  }
@@ -173,7 +175,8 @@ class User_Role_Editor {
173
  }
174
 
175
  if (!in_array($current_user->user_login, $site_admins)) {
176
- $site_admins[] = $current_user->user_login;
 
177
  }
178
 
179
  return $site_admins;
159
 
160
  global $pagenow, $current_user;
161
 
162
+ $this->lib->raised_permissions = false;
163
+
164
  if ($pagenow!=='user-new.php') {
165
  return $site_admins;
166
  }
175
  }
176
 
177
  if (!in_array($current_user->user_login, $site_admins)) {
178
+ $this->lib->raised_permissions = true;
179
+ $site_admins[] = $current_user->user_login;
180
  }
181
 
182
  return $site_admins;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladi
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
  Tested up to: 4.3.1
7
- Stable tag: 4.19.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -22,10 +22,12 @@ You can add new capabilities and remove unnecessary capabilities which could be
22
  Multi-site support is provided.
23
 
24
  To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](http://shinephp.com)
25
- Русская версия этой статьи доступна по адресу [ru.shinephp.com](http://ru.shinephp.com/user-role-editor-wordpress-plugin-rus/)
26
 
27
- Do you need more functionality with quality support in real time? Do you wish remove advertisements from User Role Editor pages?
28
- Buy [Pro version](https://www.role-editor.com).
 
 
 
29
  Pro version includes extra modules:
30
  <ul>
31
  <li>Block selected admin menu items for role.</li>
@@ -75,6 +77,12 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
 
78
  = [4.19.2] 01.10.2015 =
79
  * Fix: multiple default roles assignment did not work under the multisite environment, when user was created from front-end by WooCommerce, etc.
80
  * Update: the translation text domain was changed to the plugin slug (user-role-editor) for the compatibility with translations.wordpress.org
@@ -117,123 +125,7 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
117
  * Fixed JavaScript bug with 'Reset Roles' for FireFox v.34.
118
 
119
 
120
- = 4.18.1 =
121
- * 14.12.2014
122
- * As activation hook does not fire during bulk plugins update, automatic plugin version check and upgrade execution were added.
123
-
124
- = 4.18 =
125
- * 14.12.2014
126
- * Own custom user capabilities, e.g. 'ure_edit_roles' are used to restrict access to User Role Editor functionality ([read more](https://www.role-editor.com/user-role-editor-4-18-new-permissions/)).
127
- * If custom post type uses own custom user capabilities URE add them to the 'Custom Capabilities' section automatically.
128
- * Multisite: You may allow to the users without superadmin privileges to add/create site users without sending them email confirmation request.
129
- * Bug fix: when non-admin user updated other user profile, that user lost secondary roles.
130
- * Italian translation was added. Thanks to [Giuseppe Velardo](http://www.comprensivoleopardi.gov.it/).
131
-
132
- = 4.17.3 =
133
- * 23.11.2014
134
- * French and Turkish translation were updated. Thanks to [Transifex](https://www.transifex.com) translation team.
135
-
136
- = 4.17.2 =
137
- * 21.10.2014
138
- * Notice: "Undefined property: Ure_Lib::$pro in .../class-user-role-editor.php on line 550" was fixed.
139
- * Settings help screen text was updated.
140
- * Russian translation was updated.
141
- * Hungarian translation was updated. Thanks to Németh Balázs.
142
- * French and Turkish translation were updated. Thanks to [Transifex](https://www.transifex.com) translation team.
143
-
144
-
145
- = 4.17.1 =
146
- * 01.10.2014
147
- * Bug fix for the PHP Fatal error: Call to undefined function is_plugin_active_for_network(). It may take place under multisite only,
148
- in case no one of the other active plugins load file with this function already before User Role Editor v. 4.17 tries to call it.
149
-
150
- = 4.17 =
151
- * 01.10.2014
152
- * Multisite (update for cases when URE was not network activated): It is possible to use own settings for single site activated instances of User Role Editor.
153
- Earlier User Role Editor used the settings values from the main blog only located under "Network Admin - Settings".
154
- Some critical options were hidden from the "Multisite" tab for single site administrators and visible to the superadmin only.
155
- Single site admin should not have access to the options which purpose is to restrict him.
156
- Important! In case you decide to allow single site administrator activate/deactivate User Role Editor himself, setup this PHP constant at the wp-config.php file:
157
- define('URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE', 1);
158
- Otherwise single site admin will not see User Role Editor in the plugins list after its activation. User Role Editor hides itself under multisite from all users except superadmin by default.
159
- * Help screen for the Settings page was updated.
160
- * Hungarian translation was added. Thanks to Németh Balázs.
161
- * Dutch translation was added. Thanks to Arjan Bosch.
162
-
163
-
164
- = 4.16 =
165
- * 11.09.2014
166
- * "create_sites" user capability was added to the list of built-in WordPress user capabilities for WordPress multisite. It does not exist by default. But it is used to control "Add New" button at the "Sites" page under WordPress multisite network admin.
167
- * bug fix: WordPress database prefix value was not used in 2 SQL queries related to the "count users without role" module - updated.
168
-
169
- = 4.15 =
170
- * 08.09.2014
171
- * Rename role button was added to the URE toolbar. It allows to change user role display name (role ID is always the same). Be careful and double think before rename some built-in WordPress role.
172
-
173
- = 4.14.4 =
174
- * 08.08.2014
175
- * Missed "manage_sites" user capability was added to the list of built-in WordPress capabilities managed by User Role Editor.
176
- * Russian translation was updated.
177
-
178
- = 4.14.3 =
179
- * 25.07.2014
180
- * Integer "1" as default capability value for new added empty role was excluded for the better compatibility with WordPress core. Boolean "true" is used instead as WordPress itself does.
181
- * Integration with Gravity Forms permissions system was enhanced for WordPress multisite.
182
-
183
- = 4.14.2 =
184
- * 18.07.2014
185
- * The instance of main plugin class User_Role_Editor is available for other developers now via $GLOBALS['user_role_editor']
186
- * Compatibility issue with the theme ["WD TechGoStore"](http://wpdance.com) is resolved. This theme loads its JS and CSS stuff for admin backend uncoditionally - for all pages. While the problem is caused just by CSS URE unloads all this theme JS and CSS for optimizaiton purpose for WP admin backend pages where conflict is possible.
187
-
188
- = 4.14.1 =
189
- * 13.06.2014
190
- * MySQL query optimizing to reduce memory consumption. Thanks to [SebastiaanO](http://wordpress.org/support/topic/allowed-memory-size-exhausted-fixed).
191
- * Extra WordPress nonce field was removed from the post at main role editor page to exclude nonce duplication.
192
- * Minor code enhancements.
193
- * Fixes for some missed translations.
194
-
195
- = 4.14 =
196
- * 16.05.2014
197
- * Persian translation was added. Thanks to Morteza.
198
-
199
- = 4.12 =
200
- * 22.04.2014
201
- * Bug was fixed. It had prevented bulk move users without role (--No role for this site--) to the selected role in case such users were shown more than at one WordPress Users page.
202
- * Korean translation was added. Thanks to [Taek Yoon](http://www.ajinsys.com).
203
- * Pro version update notes:
204
- * Use new "Admin Menu" button to block selected admin menu items for role. You need to activate this module at the "Additional Modules". This feature is useful when some of submenu items are restricted by the same user capability,
205
- e.g. "Settings" submenu, but you wish allow to user work just with part of it. You may use "Admin Menu" dialog as the reference for your work with roles and capabilities as "Admin Menu" shows
206
- what user capability restrict access to what admin menu item.
207
- * Posts/Pages edit restriction feature does not prohibit to add new post/page now. Now it should be managed via 'create_posts' or 'create_pages' user capabilities.
208
- * If you use Posts/Pages edit restriction by author IDs, there is no need to add user ID to allow him edit his own posts or page. Current user is added to the allowed authors list automatically.
209
- * New tab "Additional Modules" was added to the User Role Editor options page. As per name all options related to additional modules were moved there.
210
-
211
- = 4.11 =
212
- * 06.04.2014
213
- * Single-site: It is possible to bulk move users without role (--No role for this site--) to the selected role or automatically created role "No rights" without any capabilities. Get more details at http://role-editor.com/no-role-for-this-site/
214
- * Plugin uses for dialogs jQuery UI CSS included into WordPress package.
215
- * Pro version: It is possible to restrict editing posts/pages by its authors user ID (targeted user should have edit_others_posts or edit_others_pages capability).
216
- * Pro version, multi-site: Superadmin can setup individual lists of themes available for activation to selected sites administrators.
217
- * Pro version, Gravity Forms access restriction module was tested and compatible with Gravity Forms version 1.8.5
218
-
219
- = 4.10 =
220
- * 15.02.2014
221
- * Security enhancement: WordPress text translation functions were replaced with more secure esc_html__() and esc_html_e() variants.
222
- * Pro version: It is possible to restrict access to the post or page content view for selected roles. Activate the option at plugin "Settings" page and use new "Content View Restrictions" metabox at post/page editor to setup content view access restrictions.
223
- * Pro version: Gravity Forms access management module was updated for compatibility with Gravity Forms version 1.8.3. If you need compatibility with earlier Gravity Forms versions, e.g. 1.7.9, use User Role Editor version 4.9.
224
-
225
-
226
- = 4.9 =
227
- * 19.01.2014
228
- * New tab "Default Roles" was added to the User Role Editor settings page. It is possible to select multiple default roles to assign them automatically to the new registered user.
229
- * CSS and dialog windows layout various enhancements.
230
- * 'members_get_capabilities' filter was applied to provide better compatibility with themes and plugins which may use it to add its own user capabilities.
231
- * jQuery UI CSS was updated to version 1.10.4.
232
- * Pro version: Option was added to download jQuery UI CSS from the jQuery CDN.
233
- * Pro version: Bug was fixed: Plugins activation assess restriction section was not shown for selected user under multi-site environment.
234
-
235
-
236
- Click [here](http://role-editor.com/changelog)</a> to look at [the full list of changes](http://role-editor.com/changelog) of User Role Editor plugin.
237
 
238
 
239
  == Additional Documentation ==
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
  Tested up to: 4.3.1
7
+ Stable tag: 4.19.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
22
  Multi-site support is provided.
23
 
24
  To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](http://shinephp.com)
 
25
 
26
+ Short demo about 1st steps with User Role Editor:
27
+ https://youtu.be/UmMtOmWGGxY
28
+
29
+ Do you need more functionality with quality support in real time? Do you wish to remove advertisements from User Role Editor pages?
30
+ [Buy Pro version](https://www.role-editor.com).
31
  Pro version includes extra modules:
32
  <ul>
33
  <li>Block selected admin menu items for role.</li>
77
 
78
  == Changelog ==
79
 
80
+ = [4.19.3] 14.10.2015 =
81
+ * Fix: minor CSS change.
82
+ * Automatically add all available custom post types capabilities to the administrator role under the single site environment. Custom posts types selection query updated to include all custom post types except 'built-in' when adding custom capabilities for them
83
+ * Special flag was set to indicate that single site administrator gets raised (superadmin) permissions temporary especially for the 'user-new.php' page, but current user is not the superadmin really.
84
+ (This temporary permissions raising is done to allow single site administrator to add new users under multisite if related option is active.)
85
+
86
  = [4.19.2] 01.10.2015 =
87
  * Fix: multiple default roles assignment did not work under the multisite environment, when user was created from front-end by WooCommerce, etc.
88
  * Update: the translation text domain was changed to the plugin slug (user-role-editor) for the compatibility with translations.wordpress.org
125
  * Fixed JavaScript bug with 'Reset Roles' for FireFox v.34.
126
 
127
 
128
+ Click [here](https://www.role-editor.com/changelog)</a> to look at [the full list of changes](https://www.role-editor.com/changelog) of User Role Editor plugin.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
 
131
  == Additional Documentation ==
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.19.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.19.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.19.3
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.19.3');
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__));