Version Description
- 25.07.2014
- 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.
- Integration with Gravity Forms permissions system was enhanced for WordPress multisite.
Download this release
Release Info
Developer | shinephp |
Plugin | User Role Editor |
Version | 4.14.3 |
Comparing to | |
See all releases |
Code changes from version 4.14.2 to 4.14.3
- includes/class-garvs-wp-lib.php +17 -0
- includes/class-ure-lib.php +17 -19
- readme.txt +5 -0
- user-role-editor.php +2 -2
includes/class-garvs-wp-lib.php
CHANGED
@@ -159,6 +159,23 @@ class Garvs_WP_Lib {
|
|
159 |
// end of put_option()
|
160 |
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
/**
|
163 |
* saves options array into WordPress database wp_options table
|
164 |
*/
|
159 |
// end of put_option()
|
160 |
|
161 |
|
162 |
+
/**
|
163 |
+
* Delete URE option with name option_name
|
164 |
+
* @param string $option_name
|
165 |
+
* @param bool $flush_options
|
166 |
+
*/
|
167 |
+
public function delete_option($option_name, $flush_options=false) {
|
168 |
+
if (array_key_exists($option_name, $this->options)) {
|
169 |
+
unset($this->options[$option_name]);
|
170 |
+
if ($flush_options) {
|
171 |
+
$this->flush_options();
|
172 |
+
}
|
173 |
+
}
|
174 |
+
|
175 |
+
}
|
176 |
+
// end of delete_option()
|
177 |
+
|
178 |
+
|
179 |
/**
|
180 |
* saves options array into WordPress database wp_options table
|
181 |
*/
|
includes/class-ure-lib.php
CHANGED
@@ -33,7 +33,6 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
33 |
protected $role_select_html = '';
|
34 |
protected $role_delete_html = '';
|
35 |
protected $capability_remove_html = '';
|
36 |
-
protected $integrate_with_gravity_forms = false;
|
37 |
protected $advert = null;
|
38 |
|
39 |
|
@@ -44,9 +43,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
44 |
*/
|
45 |
public function __construct($options_id) {
|
46 |
|
47 |
-
parent::__construct($options_id);
|
48 |
-
|
49 |
-
$this->integrate_with_gravity_forms = class_exists('GFForms');
|
50 |
|
51 |
|
52 |
}
|
@@ -627,14 +624,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
627 |
$cap_removed = true;
|
628 |
}
|
629 |
}
|
630 |
-
}
|
631 |
-
/*
|
632 |
-
if ($cap_removed) {
|
633 |
-
// save changes to database
|
634 |
-
$option_name = $wpdb->prefix.'user_roles';
|
635 |
-
update_option($option_name, $this->roles);
|
636 |
-
}
|
637 |
-
*/
|
638 |
} else {
|
639 |
$this->roles = $wp_roles->roles;
|
640 |
}
|
@@ -1396,7 +1386,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1396 |
}
|
1397 |
}
|
1398 |
// Get Gravity Forms plugin capabilities, if available
|
1399 |
-
if (
|
1400 |
$gf_caps = GFCommon::all_caps();
|
1401 |
foreach ($gf_caps as $gf_cap) {
|
1402 |
$this->add_capability_to_full_caps_list($gf_cap);
|
@@ -1562,6 +1552,17 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1562 |
// end of direct_network_roles_update()
|
1563 |
|
1564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1565 |
protected function wp_api_network_roles_update() {
|
1566 |
global $wpdb;
|
1567 |
|
@@ -1571,17 +1572,14 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1571 |
switch_to_blog($blog_id);
|
1572 |
$this->roles = $this->get_user_roles();
|
1573 |
if (!isset($this->roles[$this->current_role])) { // add new role to this blog
|
1574 |
-
$this->roles[$this->current_role] = array('name' => $this->current_role_name, 'capabilities' => array('read' =>
|
1575 |
}
|
1576 |
if (!$this->save_roles()) {
|
1577 |
$result = false;
|
1578 |
break;
|
1579 |
}
|
1580 |
}
|
1581 |
-
|
1582 |
-
// cleanup blog switching data
|
1583 |
-
$GLOBALS['_wp_switched_stack'] = array();
|
1584 |
-
$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
|
1585 |
$this->roles = $this->get_user_roles();
|
1586 |
|
1587 |
return $result;
|
@@ -1731,7 +1729,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1731 |
$role = $wp_roles->get_role($user_role_copy_from);
|
1732 |
$capabilities = $this->remove_caps_not_allowed_for_single_admin($role->capabilities);
|
1733 |
} else {
|
1734 |
-
$capabilities = array('read' =>
|
1735 |
}
|
1736 |
// add new role to the roles array
|
1737 |
$result = add_role($user_role_id, $user_role_name, $capabilities);
|
33 |
protected $role_select_html = '';
|
34 |
protected $role_delete_html = '';
|
35 |
protected $capability_remove_html = '';
|
|
|
36 |
protected $advert = null;
|
37 |
|
38 |
|
43 |
*/
|
44 |
public function __construct($options_id) {
|
45 |
|
46 |
+
parent::__construct($options_id);
|
|
|
|
|
47 |
|
48 |
|
49 |
}
|
624 |
$cap_removed = true;
|
625 |
}
|
626 |
}
|
627 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
628 |
} else {
|
629 |
$this->roles = $wp_roles->roles;
|
630 |
}
|
1386 |
}
|
1387 |
}
|
1388 |
// Get Gravity Forms plugin capabilities, if available
|
1389 |
+
if (class_exists('GFCommon')) {
|
1390 |
$gf_caps = GFCommon::all_caps();
|
1391 |
foreach ($gf_caps as $gf_cap) {
|
1392 |
$this->add_capability_to_full_caps_list($gf_cap);
|
1552 |
// end of direct_network_roles_update()
|
1553 |
|
1554 |
|
1555 |
+
public function restore_after_blog_switching($blog_id = 0) {
|
1556 |
+
|
1557 |
+
if (!empty($blog_id)) {
|
1558 |
+
switch_to_blog($blog_id);
|
1559 |
+
}
|
1560 |
+
// cleanup blog switching data
|
1561 |
+
$GLOBALS['_wp_switched_stack'] = array();
|
1562 |
+
$GLOBALS['switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
|
1563 |
+
}
|
1564 |
+
// end of restore_after_blog_switching(
|
1565 |
+
|
1566 |
protected function wp_api_network_roles_update() {
|
1567 |
global $wpdb;
|
1568 |
|
1572 |
switch_to_blog($blog_id);
|
1573 |
$this->roles = $this->get_user_roles();
|
1574 |
if (!isset($this->roles[$this->current_role])) { // add new role to this blog
|
1575 |
+
$this->roles[$this->current_role] = array('name' => $this->current_role_name, 'capabilities' => array('read' => true));
|
1576 |
}
|
1577 |
if (!$this->save_roles()) {
|
1578 |
$result = false;
|
1579 |
break;
|
1580 |
}
|
1581 |
}
|
1582 |
+
$this->restore_after_blog_switching($old_blog);
|
|
|
|
|
|
|
1583 |
$this->roles = $this->get_user_roles();
|
1584 |
|
1585 |
return $result;
|
1729 |
$role = $wp_roles->get_role($user_role_copy_from);
|
1730 |
$capabilities = $this->remove_caps_not_allowed_for_single_admin($role->capabilities);
|
1731 |
} else {
|
1732 |
+
$capabilities = array('read' => true, 'level_0' => true);
|
1733 |
}
|
1734 |
// add new role to the roles array
|
1735 |
$result = add_role($user_role_id, $user_role_name, $capabilities);
|
readme.txt
CHANGED
@@ -83,6 +83,11 @@ Share with me new ideas about plugin further development and link to your site w
|
|
83 |
|
84 |
|
85 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
86 |
= 4.14.2 =
|
87 |
* 18.07.2014
|
88 |
* The instance of main plugin class User_Role_Editor is available for other developers now via $GLOBALS['user_role_editor']
|
83 |
|
84 |
|
85 |
== Changelog ==
|
86 |
+
= 4.14.3 =
|
87 |
+
* 25.07.2014
|
88 |
+
* 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.
|
89 |
+
* Integration with Gravity Forms permissions system was enhanced for WordPress multisite.
|
90 |
+
|
91 |
= 4.14.2 =
|
92 |
* 18.07.2014
|
93 |
* The instance of main plugin class User_Role_Editor is available for other developers now via $GLOBALS['user_role_editor']
|
user-role-editor.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: User Role Editor
|
4 |
Plugin URI: http://role-editor.com
|
5 |
Description: Change/add/delete WordPress user roles and capabilities.
|
6 |
-
Version: 4.14.
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: http://www.shinephp.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.14.
|
27 |
define('URE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
28 |
define('URE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
29 |
define('URE_PLUGIN_FILE', basename(__FILE__));
|
3 |
Plugin Name: User Role Editor
|
4 |
Plugin URI: http://role-editor.com
|
5 |
Description: Change/add/delete WordPress user roles and capabilities.
|
6 |
+
Version: 4.14.3
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: http://www.shinephp.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.14.3');
|
27 |
define('URE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
28 |
define('URE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
29 |
define('URE_PLUGIN_FILE', basename(__FILE__));
|