Version Description
- 02.08.2013
- Separate setting page is added for User Role Editor under Settings menu. It is available under Network Center "Settings" for the multi-site.
- Option 'show Administrator role in the User Role Editor' was added.
- User with super-admin privilege only may create, edit, delete users by default under multi-site configuration. Use new "Allow create, edit and delete user to not super-administrators" option to workaround this obstacle. Such user still should have correspondent user capabilities as "create_users", "edit_users", "delete_users". Thanks to Sjobidoo for suggested decision.
- PHP fatal error caused by typo in the 'uninstall.php' file is fixed.
- Miscellaneous code enhancements.
Download this release
Release Info
Developer | shinephp |
Plugin | User Role Editor |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.1 to 4.2
- images/vum-ebook-250-250.jpg +0 -0
- images/vum-submit.jpg +0 -0
- includes/class-advertisement.php +0 -48
- includes/class-garvs-wp-lib.php +3 -24
- includes/class-ure-lib.php +103 -40
- includes/class-user-role-editor.php +199 -56
- includes/settings-template.php +65 -0
- includes/ure-role-edit.php +7 -5
- includes/ure-user-edit.php +13 -9
- readme.txt +14 -8
- uninstall.php +2 -6
- user-role-editor.php +6 -5
images/vum-ebook-250-250.jpg
DELETED
Binary file
|
images/vum-submit.jpg
DELETED
Binary file
|
includes/class-advertisement.php
CHANGED
@@ -21,10 +21,6 @@ class ure_Advertisement {
|
|
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->video_user_manuals();
|
28 |
|
29 |
}
|
30 |
// end of __construct
|
@@ -78,50 +74,6 @@ class ure_Advertisement {
|
|
78 |
return $output;
|
79 |
}
|
80 |
// end of manage_wp()
|
81 |
-
|
82 |
-
|
83 |
-
// content of Video User Manuals advertisement slot
|
84 |
-
private function video_user_manuals() {
|
85 |
-
|
86 |
-
ob_start();
|
87 |
-
?>
|
88 |
-
<div style="margin-left: 3px; margin-bottom: 3px; text-align: center; background: url(<?php echo URE_PLUGIN_URL . 'images/vum-ebook-250-250.jpg'; ?>) left top no-repeat;">
|
89 |
-
<div style="width: 250px; height: 250px; position: relative; ">
|
90 |
-
<form accept-charset="utf-8" action="https://app.getresponse.com/add_contact_webform.html" method="post" onsubmit="return quickValidate()" target="_blank">
|
91 |
-
<div style="display: none;">
|
92 |
-
<input type="hidden" name="webform_id" value="430680" />
|
93 |
-
</div>
|
94 |
-
<input id="vum_sub_name" type="text" name="name" class="text" tabindex="500" value="Enter your name" style="border: 0; position: absolute; left:129px;top:91px;height: 18px; width: 90px;background-color: #fff; font-size: 11px;" onfocus="this.value='';" />
|
95 |
-
<input class="text" id="vum_sub_email" type="text" name="email" tabindex="501" value="Email" style="border: 0; position: absolute; left:129px;top:126px;height: 18px; width: 90px;background-color: #fff; font-size: 11px;" onfocus="this.value='';" />
|
96 |
-
<input name="submit" type="image" alt="submit" tabindex="502" src="<?php echo URE_PLUGIN_URL; ?>images/vum-submit.jpg" width="100" height="25" style="background: none; border: 0;position: absolute; left:121px;top:154px;" />
|
97 |
-
<a href="http://www.videousermanuals.com/blog/report/?utm_campaign=plugin-ads&utm_medium=plugin&utm_source=user-role-editor" target="_blank" style="position: absolute; left: 7px;top: 63px;width:102px;height:152px;border:0;text-decoration: none;"> </a>
|
98 |
-
<a href="http://www.videousermanuals.com/blog/report/?utm_campaign=plugin-ads&utm_medium=plugin&utm_source=user-role-editor" target="_blank" style="position: absolute; left: 41px;top: 219px;width:163px;height:25px;border:0;text-decoration: none;"> </a>
|
99 |
-
</form>
|
100 |
-
</div>
|
101 |
-
<script type="text/javascript">
|
102 |
-
function quickValidate() {
|
103 |
-
if ((!jQuery('#vum_sub_name').val()) || (jQuery('#vum_sub_name').val() == 'Enter your name') )
|
104 |
-
{
|
105 |
-
alert('Your Name is required');
|
106 |
-
return false;
|
107 |
-
}
|
108 |
-
if ((!jQuery('#vum_sub_email').val()) || (jQuery('#vum_sub_email').val() == 'Email') )
|
109 |
-
{
|
110 |
-
alert('Your Email is required');
|
111 |
-
return false;
|
112 |
-
}
|
113 |
-
return true;
|
114 |
-
}
|
115 |
-
</script>
|
116 |
-
|
117 |
-
</div>
|
118 |
-
<?php
|
119 |
-
$output = ob_get_contents();
|
120 |
-
ob_end_clean();
|
121 |
-
|
122 |
-
return $output;
|
123 |
-
}
|
124 |
-
// end of video_user_manuals()
|
125 |
|
126 |
|
127 |
/**
|
21 |
$used[] = $index;
|
22 |
$index = $this->rand_unique( $used );
|
23 |
$this->slots[$index] = $this->manage_wp();
|
|
|
|
|
|
|
|
|
24 |
|
25 |
}
|
26 |
// end of __construct
|
74 |
return $output;
|
75 |
}
|
76 |
// end of manage_wp()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
|
79 |
/**
|
includes/class-garvs-wp-lib.php
CHANGED
@@ -14,8 +14,8 @@
|
|
14 |
class Garvs_WP_Lib {
|
15 |
|
16 |
private static $instance = null; // object exemplar reference
|
17 |
-
|
18 |
-
|
19 |
|
20 |
public $log_to_file = false; // set to true in order to record data about critical actions to log file
|
21 |
private $log_file_name = ''; // file name to write log messages
|
@@ -37,7 +37,7 @@ class Garvs_WP_Lib {
|
|
37 |
/**
|
38 |
* get current options for this plugin
|
39 |
*/
|
40 |
-
|
41 |
$this->options_id = $options_id;
|
42 |
$this->options = get_option($options_id);
|
43 |
}
|
@@ -166,28 +166,7 @@ class Garvs_WP_Lib {
|
|
166 |
}
|
167 |
}
|
168 |
// end of check_version()
|
169 |
-
|
170 |
-
|
171 |
-
/**
|
172 |
-
* plugin specific library fabric
|
173 |
-
*
|
174 |
-
* @param string $lib_id as 'ure' for User Role Editor plugin. It will creates and returns exemplar of Ure_Lib class
|
175 |
-
* file class-ure-lib.php with URE_Lib class should be place at the same folder as Garvs_WP_Lib class
|
176 |
-
* @return
|
177 |
-
*/
|
178 |
-
public static function get_library($lib_id) {
|
179 |
-
|
180 |
-
if (self::$instance==null) {
|
181 |
-
require_once( 'class-' . $lib_id .'-lib.php' );
|
182 |
-
$class_id = ucfirst($lib_id) .'_Lib';
|
183 |
-
self::$instance = new $class_id;
|
184 |
-
}
|
185 |
-
|
186 |
-
return self::$instance;
|
187 |
|
188 |
-
}
|
189 |
-
// end of get_library()
|
190 |
-
|
191 |
|
192 |
/**
|
193 |
* returns 'selected' HTML cluster if $value matches to $etalon
|
14 |
class Garvs_WP_Lib {
|
15 |
|
16 |
private 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 |
|
20 |
public $log_to_file = false; // set to true in order to record data about critical actions to log file
|
21 |
private $log_file_name = ''; // file name to write log messages
|
37 |
/**
|
38 |
* get current options for this plugin
|
39 |
*/
|
40 |
+
protected function init_options($options_id) {
|
41 |
$this->options_id = $options_id;
|
42 |
$this->options = get_option($options_id);
|
43 |
}
|
166 |
}
|
167 |
}
|
168 |
// end of check_version()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
|
|
|
|
|
|
170 |
|
171 |
/**
|
172 |
* returns 'selected' HTML cluster if $value matches to $etalon
|
includes/class-ure-lib.php
CHANGED
@@ -35,6 +35,9 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
35 |
private $capability_remove_html = '';
|
36 |
private $integrate_with_gravity_forms = false;
|
37 |
private $advert = null;
|
|
|
|
|
|
|
38 |
|
39 |
|
40 |
/** class constructor
|
@@ -44,24 +47,86 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
44 |
*/
|
45 |
function __construct() {
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
$this->integrate_with_gravity_forms = class_exists('GFForms');
|
|
|
|
|
50 |
|
51 |
}
|
52 |
// end of __construct()
|
53 |
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
/**
|
56 |
* return key capability to have access to User Role Editor Plugin
|
57 |
*
|
58 |
* @return string
|
59 |
*/
|
60 |
public function get_key_capability() {
|
61 |
-
if (
|
62 |
$key_capability = URE_KEY_CAPABILITY;
|
63 |
} else {
|
64 |
-
|
|
|
|
|
65 |
$key_capability = URE_KEY_CAPABILITY;
|
66 |
} else {
|
67 |
$key_capability = 'manage_network_users';
|
@@ -171,7 +236,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
171 |
</div>
|
172 |
|
173 |
<div class="has-sidebar" >
|
174 |
-
<form id="ure_form" method="post" action="<?php echo URE_PARENT.'?page='.URE_PLUGIN_FILE;?>" >
|
175 |
<div id="ure_form_controls">
|
176 |
<?php
|
177 |
wp_nonce_field('user-role-editor', 'ure_nonce');
|
@@ -218,8 +283,8 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
218 |
<img src="<?php echo URE_PLUGIN_URL;?>images/user-role-editor-pro-728x90.jpg" alt="User Role Editor Pro"
|
219 |
title="More functionality and premium support with Pro version of User Role Editor."/>
|
220 |
</a><br />
|
221 |
-
<label for
|
222 |
-
<input type="checkbox" name="
|
223 |
</label>
|
224 |
<?php
|
225 |
}
|
@@ -360,16 +425,12 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
360 |
} else {
|
361 |
$this->caps_readable = 1;
|
362 |
}
|
363 |
-
$this->put_option('ure_caps_readable', $this->caps_readable);
|
364 |
-
$this->flush_options();
|
365 |
} else if ($action == 'show-deprecated-caps') {
|
366 |
if ($this->show_deprecated_caps) {
|
367 |
$this->show_deprecated_caps = 0;
|
368 |
} else {
|
369 |
$this->show_deprecated_caps = 1;
|
370 |
}
|
371 |
-
$this->put_option('ure_show_deprecated_caps', $this->show_deprecated_caps);
|
372 |
-
$this->flush_options();
|
373 |
} else if ($action == 'hide-pro-banner') {
|
374 |
$this->hide_pro_banner = 1;
|
375 |
$this->put_option('ure_hide_pro_banner', 1);
|
@@ -448,7 +509,8 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
448 |
private function get_last_role_id() {
|
449 |
|
450 |
// get the key of the last element in roles array
|
451 |
-
$
|
|
|
452 |
|
453 |
return $last_role_id;
|
454 |
}
|
@@ -469,7 +531,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
469 |
return false;
|
470 |
}
|
471 |
|
472 |
-
$table_name = (
|
473 |
$meta_key = $wpdb->prefix . 'capabilities';
|
474 |
$query = "SELECT count(*)
|
475 |
FROM $table_name
|
@@ -515,7 +577,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
515 |
|
516 |
$simple_admin = $this->has_administrator_role($user_id);
|
517 |
|
518 |
-
if (
|
519 |
$super_admins = get_super_admins();
|
520 |
$super_admin = is_array($super_admins) && in_array($user->user_login, $super_admins);
|
521 |
} else {
|
@@ -643,22 +705,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
643 |
}
|
644 |
// ure_ConvertCapsToReadable
|
645 |
|
646 |
-
|
647 |
-
public function show_message($message)
|
648 |
-
{
|
649 |
-
|
650 |
-
if ($message) {
|
651 |
-
if (strpos(strtolower($message), 'error') === false) {
|
652 |
-
$class = 'updated fade';
|
653 |
-
} else {
|
654 |
-
$class = 'error';
|
655 |
-
}
|
656 |
-
echo '<div class="' . $class . '" style="margin:0;">' . $message . '</div><br style="clear: both;"/>';
|
657 |
-
}
|
658 |
-
}
|
659 |
-
// end of show_message()
|
660 |
-
|
661 |
-
|
662 |
public function make_roles_backup()
|
663 |
{
|
664 |
global $wpdb;
|
@@ -702,7 +749,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
702 |
{
|
703 |
global $wpdb;
|
704 |
|
705 |
-
$table_name = (
|
706 |
$meta_key = $wpdb->prefix . 'capabilities';
|
707 |
$default_role = get_option('default_role');
|
708 |
$standard_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
|
@@ -930,7 +977,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
930 |
private function show_capabilities($core = true, $for_role = true) {
|
931 |
|
932 |
$onclick_for_admin = '';
|
933 |
-
if (!(
|
934 |
if ($core && 'administrator' == $this->current_role) {
|
935 |
$onclick_for_admin = 'onclick="turn_it_back(this)"';
|
936 |
}
|
@@ -973,7 +1020,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
973 |
$checked = 'checked="checked"';
|
974 |
}
|
975 |
} else {
|
976 |
-
if (
|
977 |
$checked = 'checked="checked"';
|
978 |
if (!isset($this->user_to_edit->caps[$capability['inner']])) {
|
979 |
$disabled = 'disabled="disabled"';
|
@@ -1330,7 +1377,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1330 |
private function update_roles() {
|
1331 |
global $wpdb;
|
1332 |
|
1333 |
-
if (
|
1334 |
if (defined('URE_DEBUG') && URE_DEBUG) {
|
1335 |
$time_shot = microtime();
|
1336 |
}
|
@@ -1613,7 +1660,8 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1613 |
private function update_user($user) {
|
1614 |
global $wp_roles;
|
1615 |
|
1616 |
-
$
|
|
|
1617 |
if (empty($primary_role) || !isset($this->roles[$primary_role])) {
|
1618 |
$primary_role = '';
|
1619 |
}
|
@@ -1651,11 +1699,7 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1651 |
// add individual capabilities to user
|
1652 |
if (count($this->capabilities_to_save) > 0) {
|
1653 |
foreach ($this->capabilities_to_save as $key => $value) {
|
1654 |
-
|
1655 |
-
if (empty($role['capabilities'][$key])) {
|
1656 |
-
$user->add_cap($key);
|
1657 |
-
}
|
1658 |
-
}
|
1659 |
}
|
1660 |
}
|
1661 |
$user->update_user_level_from_caps();
|
@@ -1877,7 +1921,8 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1877 |
|
1878 |
private function role_edit_prepare_html() {
|
1879 |
|
1880 |
-
$
|
|
|
1881 |
|
1882 |
$this->role_default_html = '<select id="default_user_role" name="default_user_role" width="200" style="width: 200px">';
|
1883 |
$this->role_to_copy_html = '<select id="user_role_copy_from" name="user_role_copy_from" width="200" style="width: 200px">
|
@@ -1916,5 +1961,23 @@ class Ure_Lib extends Garvs_WP_Lib {
|
|
1916 |
}
|
1917 |
// end of role_edit_prepare_html()
|
1918 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1919 |
}
|
1920 |
// end of URE_Lib class
|
35 |
private $capability_remove_html = '';
|
36 |
private $integrate_with_gravity_forms = false;
|
37 |
private $advert = null;
|
38 |
+
|
39 |
+
public $multisite = false;
|
40 |
+
private $main_blog_id = 0;
|
41 |
|
42 |
|
43 |
/** class constructor
|
47 |
*/
|
48 |
function __construct() {
|
49 |
|
50 |
+
global $wpdb;
|
51 |
+
|
52 |
+
$this->multisite = function_exists('is_multisite') && is_multisite();
|
53 |
+
if ($this->multisite) {
|
54 |
+
// get Id of 1st (main) blog
|
55 |
+
$blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs order by blog_id asc");
|
56 |
+
$this->main_blog_id = $blog_ids[0];
|
57 |
+
}
|
58 |
+
|
59 |
+
$this->init_options('user_role_editor');
|
60 |
|
61 |
$this->integrate_with_gravity_forms = class_exists('GFForms');
|
62 |
+
|
63 |
+
|
64 |
|
65 |
}
|
66 |
// end of __construct()
|
67 |
|
68 |
|
69 |
+
/**
|
70 |
+
* get options for User Role Editor plugin
|
71 |
+
* User Role Editor stores its options at the main blog/site only and applies them to the all network
|
72 |
+
*
|
73 |
+
*/
|
74 |
+
protected function init_options($options_id) {
|
75 |
+
|
76 |
+
global $wpdb;
|
77 |
+
|
78 |
+
if ($this->multisite) {
|
79 |
+
$current_blog = $wpdb->blogid;
|
80 |
+
switch_to_blog($this->main_blog_id); // in order to get URE options from the main blog
|
81 |
+
}
|
82 |
+
|
83 |
+
$this->options_id = $options_id;
|
84 |
+
$this->options = get_option($options_id);
|
85 |
+
|
86 |
+
if ($this->multisite) {
|
87 |
+
// return back to the current blog
|
88 |
+
switch_to_blog($current_blog);
|
89 |
+
}
|
90 |
+
|
91 |
+
}
|
92 |
+
// end of init_options
|
93 |
+
|
94 |
+
|
95 |
+
/**
|
96 |
+
* saves options array into WordPress database wp_options table
|
97 |
+
*/
|
98 |
+
public function flush_options() {
|
99 |
+
|
100 |
+
global $wpdb;
|
101 |
+
|
102 |
+
if ($this->multisite) {
|
103 |
+
$current_blog = $wpdb->blogid;
|
104 |
+
switch_to_blog($this->main_blog_id); // in order to save URE options to the main blog
|
105 |
+
}
|
106 |
+
|
107 |
+
update_option($this->options_id, $this->options);
|
108 |
+
|
109 |
+
if ($this->multisite) {
|
110 |
+
// return back to the current blog
|
111 |
+
switch_to_blog($current_blog);
|
112 |
+
}
|
113 |
+
|
114 |
+
}
|
115 |
+
// end of flush_options()
|
116 |
+
|
117 |
+
|
118 |
/**
|
119 |
* return key capability to have access to User Role Editor Plugin
|
120 |
*
|
121 |
* @return string
|
122 |
*/
|
123 |
public function get_key_capability() {
|
124 |
+
if (!$this->multisite) {
|
125 |
$key_capability = URE_KEY_CAPABILITY;
|
126 |
} else {
|
127 |
+
$enable_simple_admin_for_multisite = $this->get_option('enable_simple_admin_for_multisite', 0);
|
128 |
+
if ( (defined('URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE') && URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE == 1) ||
|
129 |
+
$enable_simple_admin_for_multisite) {
|
130 |
$key_capability = URE_KEY_CAPABILITY;
|
131 |
} else {
|
132 |
$key_capability = 'manage_network_users';
|
236 |
</div>
|
237 |
|
238 |
<div class="has-sidebar" >
|
239 |
+
<form id="ure_form" method="post" action="<?php echo URE_PARENT.'?page=users-'.URE_PLUGIN_FILE;?>" >
|
240 |
<div id="ure_form_controls">
|
241 |
<?php
|
242 |
wp_nonce_field('user-role-editor', 'ure_nonce');
|
283 |
<img src="<?php echo URE_PLUGIN_URL;?>images/user-role-editor-pro-728x90.jpg" alt="User Role Editor Pro"
|
284 |
title="More functionality and premium support with Pro version of User Role Editor."/>
|
285 |
</a><br />
|
286 |
+
<label for="ure_hide_pro_banner">
|
287 |
+
<input type="checkbox" name="ure_hide_pro_banner" id="ure_hide_pro_banner" onclick="ure_hide_pro_banner();"/> Thanks, hide this banner.
|
288 |
</label>
|
289 |
<?php
|
290 |
}
|
425 |
} else {
|
426 |
$this->caps_readable = 1;
|
427 |
}
|
|
|
|
|
428 |
} else if ($action == 'show-deprecated-caps') {
|
429 |
if ($this->show_deprecated_caps) {
|
430 |
$this->show_deprecated_caps = 0;
|
431 |
} else {
|
432 |
$this->show_deprecated_caps = 1;
|
433 |
}
|
|
|
|
|
434 |
} else if ($action == 'hide-pro-banner') {
|
435 |
$this->hide_pro_banner = 1;
|
436 |
$this->put_option('ure_hide_pro_banner', 1);
|
509 |
private function get_last_role_id() {
|
510 |
|
511 |
// get the key of the last element in roles array
|
512 |
+
$keys = array_keys($this->roles);
|
513 |
+
$last_role_id = array_pop($keys);
|
514 |
|
515 |
return $last_role_id;
|
516 |
}
|
531 |
return false;
|
532 |
}
|
533 |
|
534 |
+
$table_name = (!$this->multisite && defined('CUSTOM_USER_META_TABLE')) ? CUSTOM_USER_META_TABLE : $wpdb->usermeta;
|
535 |
$meta_key = $wpdb->prefix . 'capabilities';
|
536 |
$query = "SELECT count(*)
|
537 |
FROM $table_name
|
577 |
|
578 |
$simple_admin = $this->has_administrator_role($user_id);
|
579 |
|
580 |
+
if ($this->multisite) {
|
581 |
$super_admins = get_super_admins();
|
582 |
$super_admin = is_array($super_admins) && in_array($user->user_login, $super_admins);
|
583 |
} else {
|
705 |
}
|
706 |
// ure_ConvertCapsToReadable
|
707 |
|
708 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
709 |
public function make_roles_backup()
|
710 |
{
|
711 |
global $wpdb;
|
749 |
{
|
750 |
global $wpdb;
|
751 |
|
752 |
+
$table_name = (!$this->multisite && defined('CUSTOM_USER_META_TABLE')) ? CUSTOM_USER_META_TABLE : $wpdb->usermeta;
|
753 |
$meta_key = $wpdb->prefix . 'capabilities';
|
754 |
$default_role = get_option('default_role');
|
755 |
$standard_roles = array('administrator', 'editor', 'author', 'contributor', 'subscriber');
|
977 |
private function show_capabilities($core = true, $for_role = true) {
|
978 |
|
979 |
$onclick_for_admin = '';
|
980 |
+
if (!( $this->multisite && is_super_admin() )) { // do not limit SuperAdmin for multi-site
|
981 |
if ($core && 'administrator' == $this->current_role) {
|
982 |
$onclick_for_admin = 'onclick="turn_it_back(this)"';
|
983 |
}
|
1020 |
$checked = 'checked="checked"';
|
1021 |
}
|
1022 |
} else {
|
1023 |
+
if ($this->user_can($capability['inner'])) {
|
1024 |
$checked = 'checked="checked"';
|
1025 |
if (!isset($this->user_to_edit->caps[$capability['inner']])) {
|
1026 |
$disabled = 'disabled="disabled"';
|
1377 |
private function update_roles() {
|
1378 |
global $wpdb;
|
1379 |
|
1380 |
+
if ($this->multisite && is_super_admin() && $this->apply_to_all) { // update Role for the all blogs/sites in the network (permitted to superadmin only)
|
1381 |
if (defined('URE_DEBUG') && URE_DEBUG) {
|
1382 |
$time_shot = microtime();
|
1383 |
}
|
1660 |
private function update_user($user) {
|
1661 |
global $wp_roles;
|
1662 |
|
1663 |
+
$values = array_values($user->roles);
|
1664 |
+
$primary_role = array_shift($values); // get 1st element from roles array as user primary role
|
1665 |
if (empty($primary_role) || !isset($this->roles[$primary_role])) {
|
1666 |
$primary_role = '';
|
1667 |
}
|
1699 |
// add individual capabilities to user
|
1700 |
if (count($this->capabilities_to_save) > 0) {
|
1701 |
foreach ($this->capabilities_to_save as $key => $value) {
|
1702 |
+
$user->add_cap($key);
|
|
|
|
|
|
|
|
|
1703 |
}
|
1704 |
}
|
1705 |
$user->update_user_level_from_caps();
|
1921 |
|
1922 |
private function role_edit_prepare_html() {
|
1923 |
|
1924 |
+
$show_admin_role = $this->get_option('show_admin_role', 0);
|
1925 |
+
$you_are_admin = ((defined('URE_SHOW_ADMIN_ROLE') && URE_SHOW_ADMIN_ROLE==1) || $show_admin_role==1) && $this->user_is_admin();
|
1926 |
|
1927 |
$this->role_default_html = '<select id="default_user_role" name="default_user_role" width="200" style="width: 200px">';
|
1928 |
$this->role_to_copy_html = '<select id="user_role_copy_from" name="user_role_copy_from" width="200" style="width: 200px">
|
1961 |
}
|
1962 |
// end of role_edit_prepare_html()
|
1963 |
|
1964 |
+
|
1965 |
+
// check if $user has $capability assigned through the roles or directly
|
1966 |
+
private function user_can($capability) {
|
1967 |
+
|
1968 |
+
if (isset($this->user_to_edit->caps[$capability])) {
|
1969 |
+
return true;
|
1970 |
+
}
|
1971 |
+
foreach ($this->user_to_edit->roles as $role) {
|
1972 |
+
if (!empty($this->roles[$role]['capabilities'][$capability])) {
|
1973 |
+
return true;
|
1974 |
+
}
|
1975 |
+
}
|
1976 |
+
|
1977 |
+
return false;
|
1978 |
+
}
|
1979 |
+
// end of user_can()
|
1980 |
+
|
1981 |
+
|
1982 |
}
|
1983 |
// end of URE_Lib class
|
includes/class-user-role-editor.php
CHANGED
@@ -12,13 +12,12 @@ class User_Role_Editor {
|
|
12 |
// common code staff, including options data processor
|
13 |
protected $lib = null;
|
14 |
|
15 |
-
public $key_capability = '
|
16 |
|
17 |
/**
|
18 |
* class constructor
|
19 |
-
*
|
20 |
*/
|
21 |
-
function __construct()
|
22 |
{
|
23 |
|
24 |
if (!is_admin()) {
|
@@ -32,15 +31,24 @@ class User_Role_Editor {
|
|
32 |
register_deactivation_hook(URE_PLUGIN_FULL_PATH, array(&$this, 'cleanup'));
|
33 |
|
34 |
// get plugin specific library object
|
35 |
-
$this->lib =
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
// Add the translation function after the plugins loaded hook.
|
40 |
add_action('plugins_loaded', array(&$this, 'load_translation'));
|
41 |
|
42 |
// add own submenu
|
43 |
add_action('admin_menu', array(&$this, 'plugin_menu'));
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
// add a Settings link in the installed plugins page
|
46 |
add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2);
|
@@ -48,7 +56,6 @@ class User_Role_Editor {
|
|
48 |
add_filter('plugin_row_meta', array(&$this, 'plugin_row_meta'), 10, 2);
|
49 |
|
50 |
}
|
51 |
-
|
52 |
// end of __construct()
|
53 |
|
54 |
|
@@ -87,16 +94,83 @@ class User_Role_Editor {
|
|
87 |
add_action( 'profile_update', array(&$this, 'user_profile_update'), 10 );
|
88 |
|
89 |
|
90 |
-
if (
|
91 |
add_action( 'wpmu_new_blog', array( &$this, 'duplicate_roles_for_new_blog'), 10, 2 );
|
92 |
-
add_filter( 'all_plugins', array( &$this, 'exclude_from_plugins_list' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
}
|
94 |
|
95 |
}
|
96 |
// end of plugin_init()
|
97 |
|
98 |
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
/**
|
101 |
* exclude administrator role from the roles list
|
102 |
*
|
@@ -185,7 +259,7 @@ class User_Role_Editor {
|
|
185 |
}
|
186 |
|
187 |
// get user_id of users with 'Administrator' role
|
188 |
-
$tableName = (
|
189 |
$meta_key = $wpdb->prefix . 'capabilities';
|
190 |
$admin_role_key = '%"administrator"%';
|
191 |
$query = "select user_id
|
@@ -227,16 +301,12 @@ class User_Role_Editor {
|
|
227 |
|
228 |
global $pagenow, $current_user;
|
229 |
|
230 |
-
if ($pagenow == 'users.php') {
|
231 |
-
|
232 |
-
(is_multisite() && defined('URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE') && URE_ENABLE_SIMPLE_ADMIN_FOR_MULTISITE == 1 &&
|
233 |
-
current_user_can('administrator'))) {
|
234 |
-
if ($current_user->has_cap(URE_KEY_CAPABILITY)) {
|
235 |
$actions['capabilities'] = '<a href="' .
|
236 |
-
wp_nonce_url("users.php?page=".URE_PLUGIN_FILE."&object=user&user_id={$user->ID}", "ure_user_{$user->ID}") .
|
237 |
'">' . __('Capabilities', 'ure') . '</a>';
|
238 |
-
}
|
239 |
-
}
|
240 |
}
|
241 |
|
242 |
return $actions;
|
@@ -326,7 +396,7 @@ class User_Role_Editor {
|
|
326 |
{
|
327 |
|
328 |
if ($file == plugin_basename(dirname(URE_PLUGIN_FULL_PATH).'/'.URE_PLUGIN_FILE)) {
|
329 |
-
$settings_link = "<a href='
|
330 |
array_unshift($links, $settings_link);
|
331 |
}
|
332 |
|
@@ -346,49 +416,122 @@ class User_Role_Editor {
|
|
346 |
}
|
347 |
|
348 |
// end of plugin_row_meta
|
|
|
349 |
|
|
|
350 |
|
|
|
|
|
|
|
|
|
|
|
351 |
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
}
|
|
|
358 |
}
|
359 |
-
// end of
|
|
|
360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
|
362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
363 |
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
-
|
370 |
-
|
|
|
371 |
|
372 |
-
|
373 |
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
// end of edit_roles()
|
392 |
|
393 |
|
394 |
// move old version option to the new storage 'user_role_editor' option, array, containing all URE options
|
@@ -424,9 +567,9 @@ class User_Role_Editor {
|
|
424 |
public function admin_load_js($hook_suffix){
|
425 |
|
426 |
if (class_exists('User_Role_Editor_Pro')) {
|
427 |
-
$ure_hook_suffix = '
|
428 |
} else {
|
429 |
-
$ure_hook_suffix = '
|
430 |
}
|
431 |
if ($hook_suffix===$ure_hook_suffix) {
|
432 |
wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core','jquery-ui-button', 'jquery') );
|
@@ -434,7 +577,7 @@ class User_Role_Editor {
|
|
434 |
wp_enqueue_script ( 'ure-js' );
|
435 |
wp_localize_script( 'ure-js', 'ure_data', array(
|
436 |
'wp_nonce' => wp_create_nonce('user-role-editor'),
|
437 |
-
'page_url' => URE_WP_ADMIN_URL . URE_PARENT .'?page='.URE_PLUGIN_FILE,
|
438 |
'is_multisite' => is_multisite() ? 1 : 0,
|
439 |
'select_all' => __('Select All', 'ure'),
|
440 |
'unselect_all' => __('Unselect All', 'ure'),
|
@@ -492,7 +635,7 @@ class User_Role_Editor {
|
|
492 |
}
|
493 |
}
|
494 |
$output = $this->lib->roles_text($roles);
|
495 |
-
echo $output . ' >> <a href="' . wp_nonce_url("users.php?page=".URE_PLUGIN_FILE."&object=user&user_id={$user->ID}", "ure_user_{$user->ID}") . '">' . __('Edit', 'ure') . '</a>';
|
496 |
?>
|
497 |
</td>
|
498 |
</tr>
|
@@ -585,4 +728,4 @@ class User_Role_Editor {
|
|
585 |
|
586 |
|
587 |
}
|
588 |
-
// end of User_Role_Editor
|
12 |
// common code staff, including options data processor
|
13 |
protected $lib = null;
|
14 |
|
15 |
+
public $key_capability = 'not allowed';
|
16 |
|
17 |
/**
|
18 |
* class constructor
|
|
|
19 |
*/
|
20 |
+
function __construct($library)
|
21 |
{
|
22 |
|
23 |
if (!is_admin()) {
|
31 |
register_deactivation_hook(URE_PLUGIN_FULL_PATH, array(&$this, 'cleanup'));
|
32 |
|
33 |
// get plugin specific library object
|
34 |
+
$this->lib = $library;
|
35 |
+
|
36 |
+
// Who may use this plugin
|
37 |
+
$this->key_capability = $this->lib->get_key_capability();
|
38 |
+
|
39 |
+
add_action('admin_init', array(&$this, 'plugin_init'), 1);
|
40 |
|
41 |
// Add the translation function after the plugins loaded hook.
|
42 |
add_action('plugins_loaded', array(&$this, 'load_translation'));
|
43 |
|
44 |
// add own submenu
|
45 |
add_action('admin_menu', array(&$this, 'plugin_menu'));
|
46 |
+
|
47 |
+
if ($this->lib->multisite) {
|
48 |
+
// add own submenu
|
49 |
+
add_action('network_admin_menu', array(&$this, 'network_plugin_menu'));
|
50 |
+
}
|
51 |
+
|
52 |
|
53 |
// add a Settings link in the installed plugins page
|
54 |
add_filter('plugin_action_links', array(&$this, 'plugin_action_links'), 10, 2);
|
56 |
add_filter('plugin_row_meta', array(&$this, 'plugin_row_meta'), 10, 2);
|
57 |
|
58 |
}
|
|
|
59 |
// end of __construct()
|
60 |
|
61 |
|
94 |
add_action( 'profile_update', array(&$this, 'user_profile_update'), 10 );
|
95 |
|
96 |
|
97 |
+
if ($this->lib->multisite) {
|
98 |
add_action( 'wpmu_new_blog', array( &$this, 'duplicate_roles_for_new_blog'), 10, 2 );
|
99 |
+
add_filter( 'all_plugins', array( &$this, 'exclude_from_plugins_list' ) );
|
100 |
+
$allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
|
101 |
+
if ($allow_edit_users_to_not_super_admin) {
|
102 |
+
add_filter( 'map_meta_cap', array($this, 'restore_users_edit_caps'), 1, 4 );
|
103 |
+
remove_all_filters( 'enable_edit_any_user_configuration' );
|
104 |
+
add_filter( 'enable_edit_any_user_configuration', '__return_true');
|
105 |
+
add_filter( 'admin_head', array($this, 'edit_user_permission_check'), 1, 4 );
|
106 |
+
}
|
107 |
}
|
108 |
|
109 |
}
|
110 |
// end of plugin_init()
|
111 |
|
112 |
|
113 |
+
/**
|
114 |
+
* restore edit_users, delete_users, create_users capabilities for non-superadmin users under multisite
|
115 |
+
* (code is provided by http://wordpress.org/support/profile/sjobidoo)
|
116 |
+
*
|
117 |
+
* @param type $caps
|
118 |
+
* @param type $cap
|
119 |
+
* @param type $user_id
|
120 |
+
* @param type $args
|
121 |
+
* @return type
|
122 |
+
*/
|
123 |
+
public function restore_users_edit_caps($caps, $cap, $user_id, $args) {
|
124 |
+
|
125 |
+
foreach ($caps as $key => $capability) {
|
126 |
+
|
127 |
+
if ($capability != 'do_not_allow')
|
128 |
+
continue;
|
129 |
+
|
130 |
+
switch ($cap) {
|
131 |
+
case 'edit_user':
|
132 |
+
case 'edit_users':
|
133 |
+
$caps[$key] = 'edit_users';
|
134 |
+
break;
|
135 |
+
case 'delete_user':
|
136 |
+
case 'delete_users':
|
137 |
+
$caps[$key] = 'delete_users';
|
138 |
+
break;
|
139 |
+
case 'create_users':
|
140 |
+
$caps[$key] = $cap;
|
141 |
+
break;
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
return $caps;
|
146 |
+
}
|
147 |
+
// end of restore_user_edit_caps()
|
148 |
+
|
149 |
+
|
150 |
+
/**
|
151 |
+
* Checks that both the editing user and the user being edited are
|
152 |
+
* members of the blog and prevents the super admin being edited.
|
153 |
+
* (code is provided by http://wordpress.org/support/profile/sjobidoo)
|
154 |
+
*
|
155 |
+
*/
|
156 |
+
function edit_user_permission_check() {
|
157 |
+
global $current_user, $profileuser;
|
158 |
+
|
159 |
+
$screen = get_current_screen();
|
160 |
+
|
161 |
+
get_currentuserinfo();
|
162 |
+
|
163 |
+
if ($screen->base == 'user-edit' || $screen->base == 'user-edit-network') { // editing a user profile
|
164 |
+
if (!is_super_admin($current_user->ID) && is_super_admin($profileuser->ID)) { // trying to edit a superadmin while himself is less than a superadmin
|
165 |
+
wp_die(__('You do not have permission to edit this user.'));
|
166 |
+
} elseif (!( is_user_member_of_blog($profileuser->ID, get_current_blog_id()) && is_user_member_of_blog($current_user->ID, get_current_blog_id()) )) { // editing user and edited user aren't members of the same blog
|
167 |
+
wp_die(__('You do not have permission to edit this user.'));
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
// end of edit_user_permission_check()
|
172 |
+
|
173 |
+
|
174 |
/**
|
175 |
* exclude administrator role from the roles list
|
176 |
*
|
259 |
}
|
260 |
|
261 |
// get user_id of users with 'Administrator' role
|
262 |
+
$tableName = (!$this->lib->multisite && defined('CUSTOM_USER_META_TABLE')) ? CUSTOM_USER_META_TABLE : $wpdb->usermeta;
|
263 |
$meta_key = $wpdb->prefix . 'capabilities';
|
264 |
$admin_role_key = '%"administrator"%';
|
265 |
$query = "select user_id
|
301 |
|
302 |
global $pagenow, $current_user;
|
303 |
|
304 |
+
if ($pagenow == 'users.php') {
|
305 |
+
if ($current_user->has_cap($this->key_capability)) {
|
|
|
|
|
|
|
306 |
$actions['capabilities'] = '<a href="' .
|
307 |
+
wp_nonce_url("users.php?page=users-".URE_PLUGIN_FILE."&object=user&user_id={$user->ID}", "ure_user_{$user->ID}") .
|
308 |
'">' . __('Capabilities', 'ure') . '</a>';
|
309 |
+
}
|
|
|
310 |
}
|
311 |
|
312 |
return $actions;
|
396 |
{
|
397 |
|
398 |
if ($file == plugin_basename(dirname(URE_PLUGIN_FULL_PATH).'/'.URE_PLUGIN_FILE)) {
|
399 |
+
$settings_link = "<a href='options-general.php?page=settings-".URE_PLUGIN_FILE."'>" . __('Settings', 'ure') . "</a>";
|
400 |
array_unshift($links, $settings_link);
|
401 |
}
|
402 |
|
416 |
}
|
417 |
|
418 |
// end of plugin_row_meta
|
419 |
+
|
420 |
|
421 |
+
public function plugin_menu() {
|
422 |
|
423 |
+
if (function_exists('add_submenu_page')) {
|
424 |
+
$ure_page = add_submenu_page('users.php', __('User Role Editor', 'ure'), __('User Role Editor', 'ure'),
|
425 |
+
$this->key_capability, 'users-'.URE_PLUGIN_FILE, array(&$this, 'edit_roles'));
|
426 |
+
add_action("admin_print_styles-$ure_page", array(&$this, 'admin_css_action'));
|
427 |
+
}
|
428 |
|
429 |
+
if (!$this->lib->multisite) {
|
430 |
+
add_options_page(
|
431 |
+
esc_html__('User Role Editor', 'ure'),
|
432 |
+
esc_html__('User Role Editor', 'ure'),
|
433 |
+
$this->key_capability, 'settings-'.URE_PLUGIN_FILE, array(&$this, 'settings'));
|
434 |
+
}
|
435 |
+
}
|
436 |
+
// end of plugin_menu()
|
437 |
+
|
438 |
+
|
439 |
+
public function network_plugin_menu() {
|
440 |
+
|
441 |
+
if (is_multisite()) {
|
442 |
+
add_submenu_page('settings.php', __('User Role Editor', 'ure'), __('User Role Editor', 'ure'),
|
443 |
+
$this->key_capability, 'settings-'.URE_PLUGIN_FILE, array(&$this, 'settings'));
|
444 |
}
|
445 |
+
|
446 |
}
|
447 |
+
// end of network_plugin_menu()
|
448 |
+
|
449 |
|
450 |
+
public function settings() {
|
451 |
+
if (isset($_POST['user_role_editor_settings_update'])) { // process update from the options form
|
452 |
+
$nonce = $_POST['_wpnonce'];
|
453 |
+
if (!wp_verify_nonce($nonce, 'user-role-editor')) {
|
454 |
+
wp_die('Security check');
|
455 |
+
}
|
456 |
|
457 |
+
if (defined('URE_SHOW_ADMIN_ROLE') && (URE_SHOW_ADMIN_ROLE==1) ) {
|
458 |
+
$show_admin_role = 1;
|
459 |
+
} else {
|
460 |
+
$show_admin_role = $this->lib->get_request_var('show_admin_role', 'checkbox');
|
461 |
+
}
|
462 |
+
$this->lib->put_option('show_admin_role', $show_admin_role);
|
463 |
+
|
464 |
+
$caps_readable = $this->lib->get_request_var('caps_readable', 'checkbox');
|
465 |
+
$this->lib->put_option('ure_caps_readable', $caps_readable);
|
466 |
+
|
467 |
+
$show_deprecated_caps = $this->lib->get_request_var('show_deprecated_caps', 'checkbox');
|
468 |
+
$this->lib->put_option('ure_show_deprecated_caps', $show_deprecated_caps);
|
469 |
+
|
470 |
+
if ($this->lib->multisite) {
|
471 |
+
$allow_edit_users_to_not_super_admin = $this->lib->get_request_var('allow_edit_users_to_not_super_admin', 'checkbox');
|
472 |
+
$this->lib->put_option('allow_edit_users_to_not_super_admin', $allow_edit_users_to_not_super_admin);
|
473 |
+
}
|
474 |
+
|
475 |
+
do_action('ure_settings_update');
|
476 |
+
|
477 |
+
$this->lib->flush_options();
|
478 |
+
$this->lib->show_message(__('User Role Editor options are updated', 'ure'));
|
479 |
+
} else { // get options from the options storage
|
480 |
+
|
481 |
+
if (defined('URE_SHOW_ADMIN_ROLE') && (URE_SHOW_ADMIN_ROLE==1) ) {
|
482 |
+
$show_admin_role = 1;
|
483 |
+
} else {
|
484 |
+
$show_admin_role = $this->lib->get_option('show_admin_role', 0);
|
485 |
+
}
|
486 |
+
$caps_readable = $this->lib->get_option('ure_caps_readable', 0);
|
487 |
+
$show_deprecated_caps = $this->lib->get_option('ure_show_deprecated_caps', 0);
|
488 |
+
if ($this->lib->multisite) {
|
489 |
+
$allow_edit_users_to_not_super_admin = $this->lib->get_option('allow_edit_users_to_not_super_admin', 0);
|
490 |
+
}
|
491 |
+
do_action('ure_settings_load');
|
492 |
+
}
|
493 |
|
494 |
+
if (is_multisite()) {
|
495 |
+
$link = 'settings.php';
|
496 |
+
} else {
|
497 |
+
$link = 'options-general.php';
|
498 |
+
}
|
499 |
+
require_once(URE_PLUGIN_DIR . 'includes/settings-template.php');
|
500 |
+
|
501 |
+
}
|
502 |
+
// end of settings()
|
503 |
+
|
504 |
+
|
505 |
+
public function admin_css_action() {
|
506 |
+
|
507 |
+
wp_enqueue_style('wp-jquery-ui-dialog');
|
508 |
+
wp_enqueue_style('ure_admin_css', URE_PLUGIN_URL . 'css/ure-admin.css', array(), false, 'screen');
|
509 |
+
}
|
510 |
+
// end of admin_css_action()
|
511 |
|
512 |
+
|
513 |
+
// call roles editor page
|
514 |
+
public function edit_roles() {
|
515 |
|
516 |
+
global $current_user;
|
517 |
|
518 |
+
if (!empty($current_user)) {
|
519 |
+
$user_id = $current_user->ID;
|
520 |
+
} else {
|
521 |
+
$user_id = false;
|
522 |
+
}
|
523 |
+
if (!$this->lib->user_is_admin($user_id)) {
|
524 |
+
if (is_multisite()) {
|
525 |
+
$admin = 'SuperAdministrator';
|
526 |
+
} else {
|
527 |
+
$admin = 'Administrator';
|
528 |
+
}
|
529 |
+
die(__('Only', 'ure') . ' ' . $admin . ' ' . __('is allowed to use', 'ure') . ' ' . 'User Role Editor');
|
530 |
+
}
|
531 |
|
532 |
+
$this->lib->editor();
|
533 |
+
}
|
534 |
+
// end of edit_roles()
|
|
|
535 |
|
536 |
|
537 |
// move old version option to the new storage 'user_role_editor' option, array, containing all URE options
|
567 |
public function admin_load_js($hook_suffix){
|
568 |
|
569 |
if (class_exists('User_Role_Editor_Pro')) {
|
570 |
+
$ure_hook_suffix = 'users_page_users-user-role-editor-pro';
|
571 |
} else {
|
572 |
+
$ure_hook_suffix = 'users_page_users-user-role-editor';
|
573 |
}
|
574 |
if ($hook_suffix===$ure_hook_suffix) {
|
575 |
wp_enqueue_script('jquery-ui-dialog', false, array('jquery-ui-core','jquery-ui-button', 'jquery') );
|
577 |
wp_enqueue_script ( 'ure-js' );
|
578 |
wp_localize_script( 'ure-js', 'ure_data', array(
|
579 |
'wp_nonce' => wp_create_nonce('user-role-editor'),
|
580 |
+
'page_url' => URE_WP_ADMIN_URL . URE_PARENT .'?page=users-'.URE_PLUGIN_FILE,
|
581 |
'is_multisite' => is_multisite() ? 1 : 0,
|
582 |
'select_all' => __('Select All', 'ure'),
|
583 |
'unselect_all' => __('Unselect All', 'ure'),
|
635 |
}
|
636 |
}
|
637 |
$output = $this->lib->roles_text($roles);
|
638 |
+
echo $output . ' >> <a href="' . wp_nonce_url("users.php?page=users-".URE_PLUGIN_FILE."&object=user&user_id={$user->ID}", "ure_user_{$user->ID}") . '">' . __('Edit', 'ure') . '</a>';
|
639 |
?>
|
640 |
</td>
|
641 |
</tr>
|
728 |
|
729 |
|
730 |
}
|
731 |
+
// end of User_Role_Editor
|
includes/settings-template.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* User Role Editor WordPress plugin options page
|
4 |
+
*
|
5 |
+
* @Author: Vladimir Garagulya
|
6 |
+
* @URL: http://role-editor.com
|
7 |
+
* @package UserRoleEditor
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
?>
|
13 |
+
<div class="wrap">
|
14 |
+
<div class="icon32" id="icon-options-general"><br/></div>
|
15 |
+
<h2><?php esc_html_e('User Role Editor - Options', 'ure'); ?></h2>
|
16 |
+
<hr/>
|
17 |
+
|
18 |
+
<form method="post" action="<?php echo $link; ?>?page=settings-<?php echo URE_PLUGIN_FILE;?>" >
|
19 |
+
<table>
|
20 |
+
<tr>
|
21 |
+
<td><label for="show_admin_role"><?php esc_html_e('Show Administrator role at User Role Editor:', 'ure'); ?></label></td>
|
22 |
+
<td><input type="checkbox" name="show_admin_role" id="show_admin_role" value="1"
|
23 |
+
<?php echo ($show_admin_role==1) ? 'checked="checked"' : ''; ?>
|
24 |
+
<?php echo defined('URE_SHOW_ADMIN_ROLE') ? 'disabled="disabled" title="Predefined by \'URE_SHOW_ADMIN_ROLE\' constant at wp-config.php"' : ''; ?> />
|
25 |
+
</td>
|
26 |
+
</tr>
|
27 |
+
<tr>
|
28 |
+
<td><label for="caps_readable"><?php esc_html_e('Show capabilities in the human readable form:', 'ure'); ?></label></td>
|
29 |
+
<td>
|
30 |
+
<input type="checkbox" name="caps_readable" id="caps_readable" value="1"
|
31 |
+
<?php echo ($caps_readable==1) ? 'checked="checked"' : ''; ?> />
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<tr>
|
35 |
+
<td><label for="show_deprecated_caps"><?php esc_html_e('Show deprecated capabilities:', 'ure'); ?></label></td>
|
36 |
+
<td>
|
37 |
+
<input type="checkbox" name="show_deprecated_caps" id="show_deprecated_caps" value="1"
|
38 |
+
<?php echo ($show_deprecated_caps==1) ? 'checked="checked"' : ''; ?> />
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
+
<?php
|
42 |
+
if ($this->lib->multisite) {
|
43 |
+
?>
|
44 |
+
<tr>
|
45 |
+
<td><label for="allow_edit_users_to_not_super_admin"><?php esc_html_e('Allow create, edit and delete user to not super-admininstrators:', 'ure'); ?></label></td>
|
46 |
+
<td>
|
47 |
+
<input type="checkbox" name="allow_edit_users_to_not_super_admin" id="allow_edit_users_to_not_super_admin" value="1"
|
48 |
+
<?php echo ($allow_edit_users_to_not_super_admin==1) ? 'checked="checked"' : ''; ?> />
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
|
52 |
+
<?php
|
53 |
+
}
|
54 |
+
|
55 |
+
do_action('ure_settings_show');
|
56 |
+
?>
|
57 |
+
</table>
|
58 |
+
<?php wp_nonce_field('user-role-editor'); ?>
|
59 |
+
<p class="submit">
|
60 |
+
<input type="submit" class="button-primary" name="user_role_editor_settings_update" value="<?php _e('Save', 'ure') ?>" />
|
61 |
+
</p>
|
62 |
+
|
63 |
+
</form>
|
64 |
+
</div>
|
65 |
+
|
includes/ure-role-edit.php
CHANGED
@@ -16,7 +16,7 @@ if (!defined('URE_PLUGIN_URL')) {
|
|
16 |
<?php
|
17 |
$this->display_box_start(__('Select Role and change its capabilities list', 'ure'), 'min-width:700px;');
|
18 |
?>
|
19 |
-
|
20 |
<?php
|
21 |
if ($this->caps_readable) {
|
22 |
$checked = 'checked="checked"';
|
@@ -39,6 +39,7 @@ if (!defined('URE_PLUGIN_URL')) {
|
|
39 |
<?php echo $checked; ?> onclick="ure_turn_deprecated_caps(0);"/>
|
40 |
<label for="ure_show_deprecated_caps"><?php _e('Show deprecated capabilities', 'ure'); ?></label>
|
41 |
</div>
|
|
|
42 |
<?php
|
43 |
if (is_multisite() && is_main_site( get_current_blog_id() ) && is_super_admin()) {
|
44 |
$hint = __('If checked, then apply action to ALL sites of this Network');
|
@@ -61,10 +62,11 @@ if (is_multisite() && is_main_site( get_current_blog_id() ) && is_super_admin())
|
|
61 |
<br /><br />
|
62 |
<hr />
|
63 |
<?php _e('Core capabilities:', 'ure'); ?>
|
64 |
-
<div style="display:table-inline; float: right; margin-right: 12px;">
|
65 |
-
|
66 |
-
|
67 |
-
</div>
|
|
|
68 |
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
|
69 |
<tr>
|
70 |
<td style="vertical-align:top;">
|
16 |
<?php
|
17 |
$this->display_box_start(__('Select Role and change its capabilities list', 'ure'), 'min-width:700px;');
|
18 |
?>
|
19 |
+
<div style="float: left;"><?php echo __('Select Role:', 'ure').' '.$this->role_select_html; ?></div>
|
20 |
<?php
|
21 |
if ($this->caps_readable) {
|
22 |
$checked = 'checked="checked"';
|
39 |
<?php echo $checked; ?> onclick="ure_turn_deprecated_caps(0);"/>
|
40 |
<label for="ure_show_deprecated_caps"><?php _e('Show deprecated capabilities', 'ure'); ?></label>
|
41 |
</div>
|
42 |
+
|
43 |
<?php
|
44 |
if (is_multisite() && is_main_site( get_current_blog_id() ) && is_super_admin()) {
|
45 |
$hint = __('If checked, then apply action to ALL sites of this Network');
|
62 |
<br /><br />
|
63 |
<hr />
|
64 |
<?php _e('Core capabilities:', 'ure'); ?>
|
65 |
+
<div style="display:table-inline; float: right; margin-right: 12px;">
|
66 |
+
<?php _e('Quick filter:', 'ure'); ?>
|
67 |
+
<input type="text" id="quick_filter" name="quick_filter" value="" size="20" onkeyup="ure_filter_capabilities(this.value);" />
|
68 |
+
</div>
|
69 |
+
|
70 |
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
|
71 |
<tr>
|
72 |
<td style="vertical-align:top;">
|
includes/ure-user-edit.php
CHANGED
@@ -56,12 +56,13 @@ if (!defined('URE_PLUGIN_URL')) {
|
|
56 |
<?php echo $checked; ?> onclick="ure_turn_deprecated_caps(<?php echo $this->user_to_edit->ID; ?>);"/>
|
57 |
<label for="ure_show_deprecated_caps"><?php _e('Show deprecated capabilities', 'ure'); ?></label>
|
58 |
</td>
|
59 |
-
</tr>
|
60 |
<tr>
|
61 |
<td class="ure-user-roles">
|
62 |
<div style="margin-bottom: 5px; font-weight: bold;"><?php echo __('Primary Role:', 'ure'); ?></div>
|
63 |
<?php
|
64 |
-
$
|
|
|
65 |
if (!empty($primary_role) && isset($this->roles[$primary_role])) {
|
66 |
echo $this->roles[$primary_role]['name'];
|
67 |
} else {
|
@@ -81,7 +82,8 @@ if (function_exists('bbp_filter_blog_editable_roles') ) { // bbPress plugin is
|
|
81 |
?>
|
82 |
<div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php echo __('Other Roles:', 'ure'); ?></div>
|
83 |
<?php
|
84 |
-
|
|
|
85 |
foreach ($this->roles as $role_id => $role) {
|
86 |
if ( ($you_are_admin || $role_id!='administrator') && ($role_id!==$primary_role) ) {
|
87 |
if ( user_can( $this->user_to_edit->ID, $role_id ) ) {
|
@@ -97,11 +99,12 @@ if (function_exists('bbp_filter_blog_editable_roles') ) { // bbPress plugin is
|
|
97 |
?>
|
98 |
</td>
|
99 |
<td style="padding-left: 5px; padding-top: 5px; border-top: 1px solid #ccc;">
|
100 |
-
<span style="font-weight: bold;"><?php _e('Core capabilities:', 'ure'); ?></span>
|
101 |
-
<div style="display:table-inline; float: right; margin-right: 12px;">
|
102 |
-
|
103 |
-
|
104 |
-
</div>
|
|
|
105 |
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
|
106 |
<tr>
|
107 |
<td style="vertical-align:top;">
|
@@ -115,7 +118,8 @@ if (function_exists('bbp_filter_blog_editable_roles') ) { // bbPress plugin is
|
|
115 |
<?php
|
116 |
$quant = count( $this->full_capabilities ) - count( $this->get_built_in_wp_caps() );
|
117 |
if ($quant>0) {
|
118 |
-
|
|
|
119 |
<span style="font-weight: bold;"><?php _e('Custom capabilities:', 'ure'); ?></span>
|
120 |
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
|
121 |
<tr>
|
56 |
<?php echo $checked; ?> onclick="ure_turn_deprecated_caps(<?php echo $this->user_to_edit->ID; ?>);"/>
|
57 |
<label for="ure_show_deprecated_caps"><?php _e('Show deprecated capabilities', 'ure'); ?></label>
|
58 |
</td>
|
59 |
+
</tr>
|
60 |
<tr>
|
61 |
<td class="ure-user-roles">
|
62 |
<div style="margin-bottom: 5px; font-weight: bold;"><?php echo __('Primary Role:', 'ure'); ?></div>
|
63 |
<?php
|
64 |
+
$values = array_values($this->user_to_edit->roles);
|
65 |
+
$primary_role = array_shift($values); // get 1st element from roles array
|
66 |
if (!empty($primary_role) && isset($this->roles[$primary_role])) {
|
67 |
echo $this->roles[$primary_role]['name'];
|
68 |
} else {
|
82 |
?>
|
83 |
<div style="margin-top: 5px;margin-bottom: 5px; font-weight: bold;"><?php echo __('Other Roles:', 'ure'); ?></div>
|
84 |
<?php
|
85 |
+
$show_admin_role = $this->get_option('show_admin_role', 0);
|
86 |
+
$you_are_admin = ((defined('URE_SHOW_ADMIN_ROLE') && URE_SHOW_ADMIN_ROLE==1) || $show_admin_role==1) && $this->user_is_admin();
|
87 |
foreach ($this->roles as $role_id => $role) {
|
88 |
if ( ($you_are_admin || $role_id!='administrator') && ($role_id!==$primary_role) ) {
|
89 |
if ( user_can( $this->user_to_edit->ID, $role_id ) ) {
|
99 |
?>
|
100 |
</td>
|
101 |
<td style="padding-left: 5px; padding-top: 5px; border-top: 1px solid #ccc;">
|
102 |
+
<span style="font-weight: bold;"><?php _e('Core capabilities:', 'ure'); ?></span>
|
103 |
+
<div style="display:table-inline; float: right; margin-right: 12px;">
|
104 |
+
<?php _e('Quick filter:', 'ure'); ?>
|
105 |
+
<input type="text" id="quick_filter" name="quick_filter" value="" size="20" onkeyup="ure_filter_capabilities(this.value);" />
|
106 |
+
</div>
|
107 |
+
|
108 |
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
|
109 |
<tr>
|
110 |
<td style="vertical-align:top;">
|
118 |
<?php
|
119 |
$quant = count( $this->full_capabilities ) - count( $this->get_built_in_wp_caps() );
|
120 |
if ($quant>0) {
|
121 |
+
echo '<hr />';
|
122 |
+
?>
|
123 |
<span style="font-weight: bold;"><?php _e('Custom capabilities:', 'ure'); ?></span>
|
124 |
<table class="form-table" style="clear:none;" cellpadding="0" cellspacing="0">
|
125 |
<tr>
|
readme.txt
CHANGED
@@ -23,8 +23,7 @@ Do you need more functionality with quality support in real time? Do you not lik
|
|
23 |
Buy [Pro version](htpp://role-editor.com).
|
24 |
Pro version is advertisement free. Pro version includes the "Export/Import" module. You can export user roles to the local file and import them then
|
25 |
to any WordPress site or other sites of the multi-site WordPress network. More functionality modules will follow for Pro version.
|
26 |
-
|
27 |
-
To subscribe for Premium support only visit [role-editor.com](htpp://role-editor.com). Premium support is provided by User Role Editor plugin author Vladimir Garagulya. You will get an answer on your question not once a week or never, but in 24 hours.
|
28 |
|
29 |
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)
|
30 |
|
@@ -56,12 +55,6 @@ To read full FAQ section visit [this page](http://www.shinephp.com/user-role-edi
|
|
56 |
To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](shinephp.com).
|
57 |
|
58 |
|
59 |
-
== Special Thanks to ==
|
60 |
-
* [Lorenzo Nicoletti](http://www.extera.com) - For the code enhancement. CUSTOM_USER_META_TABLE constant is used now for more compatibility with core WordPress API.
|
61 |
-
* Marcin - For the code enhancement. This contribution allows to not lose new custom capability if it is added to other than 'Administrator' role.
|
62 |
-
* [FullThrottle](http://fullthrottledevelopment.com/how-to-hide-the-adminstrator-on-the-wordpress-users-screen) - For the code to hide administrator role at admin backend.
|
63 |
-
|
64 |
-
|
65 |
= Translations =
|
66 |
* Catalan: [Efraim Bayarri](http://replicantsfactory.com/)
|
67 |
* Turkish: [Muhammed YILDIRIM](http://ben.muhammed.im)
|
@@ -76,6 +69,19 @@ Share with me new ideas about plugin further development and link to your site w
|
|
76 |
|
77 |
|
78 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 4.1.1 =
|
80 |
* 15.07.2013
|
81 |
* Issue when "users with "Editor" credentials were no longer able to change the author name in the drop down on each post to someone with administrative credentials" is fixed.
|
23 |
Buy [Pro version](htpp://role-editor.com).
|
24 |
Pro version is advertisement free. Pro version includes the "Export/Import" module. You can export user roles to the local file and import them then
|
25 |
to any WordPress site or other sites of the multi-site WordPress network. More functionality modules will follow for Pro version.
|
26 |
+
Premium support is included. Premium support is provided by User Role Editor plugin author Vladimir Garagulya. You will get an answer on your question not once a week or never, but in 24 hours.
|
|
|
27 |
|
28 |
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)
|
29 |
|
55 |
To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](shinephp.com).
|
56 |
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
= Translations =
|
59 |
* Catalan: [Efraim Bayarri](http://replicantsfactory.com/)
|
60 |
* Turkish: [Muhammed YILDIRIM](http://ben.muhammed.im)
|
69 |
|
70 |
|
71 |
== Changelog ==
|
72 |
+
|
73 |
+
= 4.2 =
|
74 |
+
* 02.08.2013
|
75 |
+
* Separate setting page is added for User Role Editor under Settings menu. It is available under Network Center "Settings" for the multi-site.
|
76 |
+
* Option 'show Administrator role in the User Role Editor' was added.
|
77 |
+
* User with super-admin privilege only may create, edit, delete users by default under multi-site configuration.
|
78 |
+
Use new "Allow create, edit and delete user to not super-administrators" option to workaround this obstacle.
|
79 |
+
Such user still should have correspondent user capabilities as "create_users", "edit_users", "delete_users".
|
80 |
+
Thanks to [Sjobidoo](http://wordpress.org/support/profile/sjobidoo) for suggested
|
81 |
+
[decision](http://wordpress.org/support/topic/plugin-user-role-editor-not-able-to-add-ability-to-edit-users).
|
82 |
+
* PHP fatal error caused by typo in the 'uninstall.php' file is fixed.
|
83 |
+
* Miscellaneous code enhancements.
|
84 |
+
|
85 |
= 4.1.1 =
|
86 |
* 15.07.2013
|
87 |
* Issue when "users with "Editor" credentials were no longer able to change the author name in the drop down on each post to someone with administrative credentials" is fixed.
|
uninstall.php
CHANGED
@@ -29,14 +29,10 @@ if (!is_multisite()) {
|
|
29 |
delete_option($backup_option_name);
|
30 |
delete_option('ure_caps_readable');
|
31 |
delete_option('ure_show_deprecated_caps');
|
32 |
-
|
33 |
-
|
34 |
}
|
35 |
switch_to_blog($old_blog);
|
36 |
}
|
37 |
|
38 |
-
if (file_exist('uninstall-pro.php')) {
|
39 |
-
include('uninstall-pro.php');
|
40 |
-
}
|
41 |
-
|
42 |
?>
|
29 |
delete_option($backup_option_name);
|
30 |
delete_option('ure_caps_readable');
|
31 |
delete_option('ure_show_deprecated_caps');
|
32 |
+
delete_option('ure_hide_pro_banner');
|
33 |
+
delete_option('user_role_editor');
|
34 |
}
|
35 |
switch_to_blog($old_blog);
|
36 |
}
|
37 |
|
|
|
|
|
|
|
|
|
38 |
?>
|
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.
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: http://www.shinephp.com
|
9 |
Text Domain: ure
|
@@ -30,27 +30,28 @@ define('URE_PLUGIN_FILE', basename(__FILE__));
|
|
30 |
define('URE_PLUGIN_FULL_PATH', __FILE__);
|
31 |
|
32 |
require_once(URE_PLUGIN_DIR.'includes/class-garvs-wp-lib.php');
|
|
|
33 |
|
34 |
// check PHP version
|
35 |
$ure_required_php_version = '5.2.4';
|
36 |
$exit_msg = sprintf( 'User Role Editor requires PHP %s or newer.', $ure_required_php_version ) .
|
37 |
'<a href="http://wordpress.org/about/requirements/"> ' . 'Please update!' . '</a>';
|
38 |
-
|
39 |
|
40 |
// check WP version
|
41 |
$ure_required_wp_version = '3.5';
|
42 |
$exit_msg = sprintf( 'User Role Editor requires WordPress %s or newer.', $ure_required_wp_version ) .
|
43 |
'<a href="http://codex.wordpress.org/Upgrading_WordPress"> ' . 'Please update!' . '</a>';
|
44 |
-
|
45 |
|
46 |
require_once(URE_PLUGIN_DIR .'includes/define-constants.php');
|
47 |
require_once(URE_PLUGIN_DIR .'includes/misc-support-stuff.php');
|
48 |
|
49 |
if (!class_exists('User_Role_Editor')) {
|
50 |
-
require_once( URE_PLUGIN_DIR .'includes/class-ure-lib.php');
|
51 |
require_once( URE_PLUGIN_DIR .'includes/class-user-role-editor.php');
|
52 |
}
|
53 |
|
54 |
-
new
|
|
|
55 |
|
56 |
|
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.2
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: http://www.shinephp.com
|
9 |
Text Domain: ure
|
30 |
define('URE_PLUGIN_FULL_PATH', __FILE__);
|
31 |
|
32 |
require_once(URE_PLUGIN_DIR.'includes/class-garvs-wp-lib.php');
|
33 |
+
require_once(URE_PLUGIN_DIR.'includes/class-ure-lib.php');
|
34 |
|
35 |
// check PHP version
|
36 |
$ure_required_php_version = '5.2.4';
|
37 |
$exit_msg = sprintf( 'User Role Editor requires PHP %s or newer.', $ure_required_php_version ) .
|
38 |
'<a href="http://wordpress.org/about/requirements/"> ' . 'Please update!' . '</a>';
|
39 |
+
Ure_Lib::check_version( PHP_VERSION, $ure_required_php_version, $exit_msg, __FILE__ );
|
40 |
|
41 |
// check WP version
|
42 |
$ure_required_wp_version = '3.5';
|
43 |
$exit_msg = sprintf( 'User Role Editor requires WordPress %s or newer.', $ure_required_wp_version ) .
|
44 |
'<a href="http://codex.wordpress.org/Upgrading_WordPress"> ' . 'Please update!' . '</a>';
|
45 |
+
Ure_Lib::check_version(get_bloginfo('version'), $ure_required_wp_version, $exit_msg, __FILE__ );
|
46 |
|
47 |
require_once(URE_PLUGIN_DIR .'includes/define-constants.php');
|
48 |
require_once(URE_PLUGIN_DIR .'includes/misc-support-stuff.php');
|
49 |
|
50 |
if (!class_exists('User_Role_Editor')) {
|
|
|
51 |
require_once( URE_PLUGIN_DIR .'includes/class-user-role-editor.php');
|
52 |
}
|
53 |
|
54 |
+
$ure_lib = new Ure_Lib('user-role-editor');
|
55 |
+
new User_Role_Editor($ure_lib);
|
56 |
|
57 |
|