User Role Editor - Version 4.18.1

Version Description

  • 14.12.2014
  • As activation hook does not fire during bulk plugins update, automatic plugin version check and upgrade execution were added.
Download this release

Release Info

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

Code changes from version 4.18 to 4.18.1

Files changed (3) hide show
  1. includes/class-ure-lib.php +20 -2
  2. readme.txt +4 -0
  3. user-role-editor.php +2 -2
includes/class-ure-lib.php CHANGED
@@ -43,12 +43,26 @@ class Ure_Lib extends Garvs_WP_Lib {
43
  */
44
  public function __construct($options_id) {
45
 
46
- parent::__construct($options_id);
47
 
 
48
  }
49
  // end of __construct()
50
 
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  /**
53
  * Is this the Pro version?
54
  * @return boolean
@@ -86,6 +100,10 @@ class Ure_Lib extends Garvs_WP_Lib {
86
  protected function _init_ure_caps() {
87
  global $wp_roles;
88
 
 
 
 
 
89
  if (!isset($wp_roles->roles['administrator'])) {
90
  return;
91
  }
@@ -140,7 +158,7 @@ class Ure_Lib extends Garvs_WP_Lib {
140
  protected function init_options($options_id) {
141
 
142
  global $wpdb;
143
-
144
  if ($this->multisite) {
145
  if ( ! function_exists( 'is_plugin_active_for_network' ) ) { // Be sure the function is defined before trying to use it
146
  require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
43
  */
44
  public function __construct($options_id) {
45
 
46
+ parent::__construct($options_id);
47
 
48
+ $this->upgrade();
49
  }
50
  // end of __construct()
51
 
52
 
53
+ protected function upgrade() {
54
+
55
+ $ure_version = $this->get_option('ure_version', '0');
56
+ if (version_compare( $ure_version, URE_VERSION, '<' ) ) {
57
+ // for upgrade to 4.18 and higher from older versions
58
+ $this->init_ure_caps();
59
+ $this->put_option('ure_version', URE_VERSION, true);
60
+ }
61
+
62
+ }
63
+ // end of upgrade()
64
+
65
+
66
  /**
67
  * Is this the Pro version?
68
  * @return boolean
100
  protected function _init_ure_caps() {
101
  global $wp_roles;
102
 
103
+ if (!isset($wp_roles)) {
104
+ $wp_roles = new WP_Roles();
105
+ }
106
+
107
  if (!isset($wp_roles->roles['administrator'])) {
108
  return;
109
  }
158
  protected function init_options($options_id) {
159
 
160
  global $wpdb;
161
+
162
  if ($this->multisite) {
163
  if ( ! function_exists( 'is_plugin_active_for_network' ) ) { // Be sure the function is defined before trying to use it
164
  require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
readme.txt CHANGED
@@ -87,6 +87,10 @@ Some translations may be outdated. If you have better translation for some phras
87
 
88
  == Changelog ==
89
 
 
 
 
 
90
  = 4.18 =
91
  * 14.12.2014
92
  * 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/)).
87
 
88
  == Changelog ==
89
 
90
+ = 4.18.1 =
91
+ * 14.12.2014
92
+ * As activation hook does not fire during bulk plugins update, automatic plugin version check and upgrade execution were added.
93
+
94
  = 4.18 =
95
  * 14.12.2014
96
  * 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/)).
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.18
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.18');
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: http://role-editor.com
5
  Description: Change/add/delete WordPress user roles and capabilities.
6
+ Version: 4.18.1
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.18.1');
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__));