Version Description
Download this release
Release Info
Developer | shinephp |
Plugin | User Role Editor |
Version | 4.40.3 |
Comparing to | |
See all releases |
Code changes from version 4.40.1 to 4.40.3
- includes/classes/bbpress.php +38 -32
- includes/classes/ure-lib.php +10 -8
- readme.txt +7 -2
- user-role-editor.php +2 -2
includes/classes/bbpress.php
CHANGED
@@ -10,42 +10,39 @@
|
|
10 |
**/
|
11 |
|
12 |
class URE_bbPress {
|
13 |
-
|
14 |
-
public static $instance = null;
|
15 |
-
|
16 |
protected $lib = null;
|
|
|
17 |
|
18 |
|
19 |
-
|
20 |
|
21 |
$this->lib = $lib;
|
22 |
|
|
|
23 |
}
|
24 |
// end of __construct()
|
|
|
25 |
|
26 |
-
|
27 |
-
static public function get_instance(URE_Lib $lib) {
|
28 |
|
29 |
if (!function_exists('is_plugin_active')) {
|
30 |
require_once(ABSPATH .'/wp-admin/includes/plugin.php');
|
31 |
}
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
if (self::$instance!==null) {
|
37 |
-
return self::$instance;
|
38 |
}
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
-
return
|
47 |
}
|
48 |
-
// end of
|
49 |
|
50 |
|
51 |
/**
|
@@ -56,9 +53,12 @@ class URE_bbPress {
|
|
56 |
*/
|
57 |
public function get_roles() {
|
58 |
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
62 |
|
63 |
return $roles;
|
64 |
}
|
@@ -71,7 +71,12 @@ class URE_bbPress {
|
|
71 |
* @return array
|
72 |
*/
|
73 |
public function get_caps() {
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
return $caps;
|
77 |
}
|
@@ -98,19 +103,20 @@ class URE_bbPress {
|
|
98 |
* @return array
|
99 |
*/
|
100 |
public function extract_bbp_roles($roles) {
|
101 |
-
|
102 |
-
$all_bbp_roles = array_keys(bbp_get_dynamic_roles());
|
103 |
$user_bbp_roles = array();
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
109 |
|
110 |
-
return $user_bbp_roles;
|
111 |
}
|
112 |
// end of extract_bbp_roles()
|
113 |
|
114 |
-
|
115 |
}
|
116 |
// end of URE_bbPress class
|
10 |
**/
|
11 |
|
12 |
class URE_bbPress {
|
13 |
+
|
|
|
|
|
14 |
protected $lib = null;
|
15 |
+
protected $bbpress_detected = false;
|
16 |
|
17 |
|
18 |
+
public function __construct(URE_Lib $lib) {
|
19 |
|
20 |
$this->lib = $lib;
|
21 |
|
22 |
+
add_action('plugins_loaded', array($this, 'detect_bbpress'), 8);
|
23 |
}
|
24 |
// end of __construct()
|
25 |
+
|
26 |
|
27 |
+
public function detect_bbpress() {
|
|
|
28 |
|
29 |
if (!function_exists('is_plugin_active')) {
|
30 |
require_once(ABSPATH .'/wp-admin/includes/plugin.php');
|
31 |
}
|
32 |
+
$this->bbpress_detected = false;
|
33 |
+
if (function_exists('bbp_filter_blog_editable_roles')) {
|
34 |
+
$this->bbpress_detected = true; // bbPress plugin is installed and active
|
|
|
|
|
|
|
35 |
}
|
36 |
|
37 |
+
}
|
38 |
+
// end of detect_bbpress()
|
39 |
+
|
40 |
+
|
41 |
+
public function is_active() {
|
42 |
|
43 |
+
return $this->bbpress_detected;
|
44 |
}
|
45 |
+
// end of is_active()
|
46 |
|
47 |
|
48 |
/**
|
53 |
*/
|
54 |
public function get_roles() {
|
55 |
|
56 |
+
$wp_roles = wp_roles();
|
57 |
+
if ($this->bbpress_detected) {
|
58 |
+
$roles = bbp_filter_blog_editable_roles($wp_roles->roles); // exclude bbPress roles
|
59 |
+
} else {
|
60 |
+
$roles = $wp_roles->roles;
|
61 |
+
}
|
62 |
|
63 |
return $roles;
|
64 |
}
|
71 |
* @return array
|
72 |
*/
|
73 |
public function get_caps() {
|
74 |
+
|
75 |
+
if ($this->bbpress_detected) {
|
76 |
+
$caps = array_keys(bbp_get_caps_for_role(bbp_get_keymaster_role()));
|
77 |
+
} else {
|
78 |
+
$caps = array();
|
79 |
+
}
|
80 |
|
81 |
return $caps;
|
82 |
}
|
103 |
* @return array
|
104 |
*/
|
105 |
public function extract_bbp_roles($roles) {
|
106 |
+
|
|
|
107 |
$user_bbp_roles = array();
|
108 |
+
if ($this->bbpress_detected) {
|
109 |
+
$all_bbp_roles = array_keys(bbp_get_dynamic_roles());
|
110 |
+
foreach($roles as $role) {
|
111 |
+
if (in_array($role, $all_bbp_roles)) {
|
112 |
+
$user_bbp_roles[] = $role;
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
|
117 |
+
return $user_bbp_roles;
|
118 |
}
|
119 |
// end of extract_bbp_roles()
|
120 |
|
|
|
121 |
}
|
122 |
// end of URE_bbPress class
|
includes/classes/ure-lib.php
CHANGED
@@ -54,7 +54,11 @@ class URE_Lib extends URE_Base_Lib {
|
|
54 |
parent::__construct($options_id);
|
55 |
$this->debug = defined('URE_DEBUG') && (URE_DEBUG==1 || URE_DEBUG==true);
|
56 |
|
57 |
-
$this->
|
|
|
|
|
|
|
|
|
58 |
|
59 |
$this->upgrade();
|
60 |
}
|
@@ -561,7 +565,7 @@ class URE_Lib extends URE_Base_Lib {
|
|
561 |
*/
|
562 |
public function get_user_roles() {
|
563 |
|
564 |
-
if (
|
565 |
$this->roles = $this->bbpress->get_roles();
|
566 |
} else {
|
567 |
$wp_roles = wp_roles();
|
@@ -586,22 +590,20 @@ class URE_Lib extends URE_Base_Lib {
|
|
586 |
if (empty($this->roles)) {
|
587 |
$this->get_user_roles();
|
588 |
}
|
589 |
-
if ($this->bbpress
|
590 |
remove_filter('editable_roles', 'bbp_filter_blog_editable_roles');
|
591 |
}
|
592 |
$roles = apply_filters('editable_roles', $this->roles);
|
593 |
-
if ($this->bbpress
|
594 |
add_filter('editable_roles', 'bbp_filter_blog_editable_roles');
|
595 |
}
|
596 |
|
597 |
return $roles;
|
598 |
-
|
599 |
}
|
600 |
// end of get_editable_user_roles()
|
601 |
|
602 |
|
603 |
-
protected function convert_caps_to_readable($caps_name)
|
604 |
-
{
|
605 |
|
606 |
$caps_name = str_replace('_', ' ', $caps_name);
|
607 |
$caps_name = ucfirst($caps_name);
|
@@ -892,7 +894,7 @@ class URE_Lib extends URE_Base_Lib {
|
|
892 |
*/
|
893 |
protected function add_bbpress_caps() {
|
894 |
|
895 |
-
if (
|
896 |
return;
|
897 |
}
|
898 |
|
54 |
parent::__construct($options_id);
|
55 |
$this->debug = defined('URE_DEBUG') && (URE_DEBUG==1 || URE_DEBUG==true);
|
56 |
|
57 |
+
if ($this->is_pro()) {
|
58 |
+
$this->bbpress = new URE_bbPress_Pro($this);
|
59 |
+
} else {
|
60 |
+
$this->bbpress = new URE_bbPress($this);
|
61 |
+
}
|
62 |
|
63 |
$this->upgrade();
|
64 |
}
|
565 |
*/
|
566 |
public function get_user_roles() {
|
567 |
|
568 |
+
if ($this->bbpress->is_active()) { // bbPress plugin is active
|
569 |
$this->roles = $this->bbpress->get_roles();
|
570 |
} else {
|
571 |
$wp_roles = wp_roles();
|
590 |
if (empty($this->roles)) {
|
591 |
$this->get_user_roles();
|
592 |
}
|
593 |
+
if ($this->bbpress->is_active()) {
|
594 |
remove_filter('editable_roles', 'bbp_filter_blog_editable_roles');
|
595 |
}
|
596 |
$roles = apply_filters('editable_roles', $this->roles);
|
597 |
+
if ($this->bbpress->is_active()) {
|
598 |
add_filter('editable_roles', 'bbp_filter_blog_editable_roles');
|
599 |
}
|
600 |
|
601 |
return $roles;
|
|
|
602 |
}
|
603 |
// end of get_editable_user_roles()
|
604 |
|
605 |
|
606 |
+
protected function convert_caps_to_readable($caps_name) {
|
|
|
607 |
|
608 |
$caps_name = str_replace('_', ' ', $caps_name);
|
609 |
$caps_name = ucfirst($caps_name);
|
894 |
*/
|
895 |
protected function add_bbpress_caps() {
|
896 |
|
897 |
+
if (!$this->bbpress->is_active()) {
|
898 |
return;
|
899 |
}
|
900 |
|
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¤cy_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.9.
|
7 |
-
Stable tag: 4.40.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -79,6 +79,11 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
|
|
79 |
|
80 |
|
81 |
== Changelog =
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
= [4.40.1] 09.03.2018 =
|
84 |
* Update: wp_roles() function (introduced with WP 4.3) was included conditionally to URE code for backward compatibility with WordPress 4.0+
|
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¤cy_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.9.5
|
7 |
+
Stable tag: 4.40.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
79 |
|
80 |
|
81 |
== Changelog =
|
82 |
+
= [4.40.3] 06.04.2018 =
|
83 |
+
* Update: bbPress detection and code for integration with it was updated to support multisite installations when URE is network activated but bbPress is activated on some sites of the network only. (Free version does not support bbPress roles. It excludes them from processing as bbPress creates them dynamically.)
|
84 |
+
|
85 |
+
= [4.40.2] 04.04.2018 =
|
86 |
+
* Update: Load required .php files from the active bbPress plugin directly, as in some cases URE code may be executed earlier than they are loaded by bbPress.
|
87 |
|
88 |
= [4.40.1] 09.03.2018 =
|
89 |
* Update: wp_roles() function (introduced with WP 4.3) was included conditionally to URE code for backward compatibility with WordPress 4.0+
|
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.40.
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: https://www.role-editor.com
|
9 |
Text Domain: user-role-editor
|
@@ -23,7 +23,7 @@ if (defined('URE_PLUGIN_URL')) {
|
|
23 |
wp_die('It seems that other version of User Role Editor is active. Please deactivate it before use this version');
|
24 |
}
|
25 |
|
26 |
-
define('URE_VERSION', '4.40.
|
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.40.3
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: https://www.role-editor.com
|
9 |
Text Domain: user-role-editor
|
23 |
wp_die('It seems that other version of User Role Editor is active. Please deactivate it before use this version');
|
24 |
}
|
25 |
|
26 |
+
define('URE_VERSION', '4.40.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__));
|