WPFront User Role Editor - Version 1.2

Version Description

  • Restore role
  • Bug fixes
Download this release

Release Info

Developer syammohanm
Plugin Icon 128x128 WPFront User Role Editor
Version 1.2
Comparing to
See all releases

Code changes from version 1.3 to 1.2

classes/class-wpfront-user-role-editor-add-edit.php CHANGED
@@ -118,7 +118,7 @@ if (!class_exists('WPFront_User_Role_Editor_Add_Edit')) {
118
  }
119
 
120
  if ($success) {
121
- printf('<script type="text/javascript">window.location.replace("%s");</script>', $this->list_roles_url());
122
  } else {
123
  include($this->main->pluginDIR() . 'templates/add-edit-role.php');
124
  }
118
  }
119
 
120
  if ($success) {
121
+ printf('<script type="text/javascript">document.location="%s";</script>', $this->list_roles_url());
122
  } else {
123
  include($this->main->pluginDIR() . 'templates/add-edit-role.php');
124
  }
classes/class-wpfront-user-role-editor-assign-roles.php DELETED
@@ -1,306 +0,0 @@
1
- <?php
2
- /*
3
- WPFront User Role Editor Plugin
4
- Copyright (C) 2014, WPFront.com
5
- Website: wpfront.com
6
- Contact: syam@wpfront.com
7
-
8
- WPFront User Role Editor Plugin is distributed under the GNU General Public License, Version 3,
9
- June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
10
- St, Fifth Floor, Boston, MA 02110, USA
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
13
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
16
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
- */
23
-
24
-
25
- if (!class_exists('WPFront_User_Role_Editor_Assign_Roles')) {
26
-
27
- /**
28
- * Assign Roles
29
- *
30
- * @author Syam Mohan <syam@wpfront.com>
31
- * @copyright 2014 WPFront.com
32
- */
33
- class WPFront_User_Role_Editor_Assign_Roles {
34
-
35
- const MENU_SLUG = 'wpfront-user-role-editor-assign-roles';
36
- const SECONDARY_ROLE_COLUMN_KEY = 'secondary_roles';
37
-
38
- private $main;
39
- private $user = NULL;
40
- private $userPrimaryRole = '';
41
- private $userSecondaryRoles = array();
42
- private $users;
43
- private $migrateFromPrimaryRole = NULL;
44
- private $migrateToPrimaryRole = NULL;
45
- private $migrateToSecondaryRoles = array();
46
- private $primary_roles;
47
- private $secondary_roles;
48
- private $result = NULL;
49
-
50
- function __construct($main) {
51
- $this->main = $main;
52
-
53
- add_filter('manage_users_columns', array($this, 'manage_users_columns'));
54
- add_action('manage_users_custom_column', array($this, 'manage_users_columns_content'), 10, 3);
55
-
56
- add_filter('user_row_actions', array($this, 'user_row_actions'), 10, 2);
57
- }
58
-
59
- public function manage_users_columns($columns) {
60
- $columns[self::SECONDARY_ROLE_COLUMN_KEY] = $this->__('Secondary Roles');
61
-
62
- return $columns;
63
- }
64
-
65
- public function manage_users_columns_content($value, $column_name, $user_id) {
66
- if ($column_name == self::SECONDARY_ROLE_COLUMN_KEY) {
67
- $user = get_userdata($user_id);
68
- return $this->get_secondary_role_list($user->roles);
69
- }
70
- return $value;
71
- }
72
-
73
- public function user_row_actions($actions, $user_object) {
74
- if ($this->can_assign_roles() && $user_object->ID !== wp_get_current_user()->ID)
75
- $actions['assign_roles'] = sprintf('<a href="%s">%s</a>', $this->get_assign_role_url($user_object), $this->__('Assign Roles'));
76
- return $actions;
77
- }
78
-
79
- private function can_assign_roles() {
80
- return current_user_can('promote_users') && current_user_can('list_users');
81
- }
82
-
83
- private function get_assign_role_url($user_object = NULL) {
84
- if ($user_object == NULL)
85
- return admin_url('users.php') . '?page=' . self::MENU_SLUG . '&assign_roles=';
86
- return $this->get_assign_role_url() . $user_object->ID;
87
- }
88
-
89
- private function get_secondary_role_list($roles) {
90
- $names = array();
91
-
92
- global $wp_roles;
93
-
94
- foreach ($roles as $value) {
95
- if (array_key_exists($value, $wp_roles->role_names)) {
96
- $names[] = $wp_roles->role_names[$value];
97
- }
98
- }
99
-
100
- array_shift($names);
101
- return implode(', ', $names);
102
- }
103
-
104
- private function __($s) {
105
- return $this->main->__($s);
106
- }
107
-
108
- public function assign_roles() {
109
- if (!$this->can_assign_roles()) {
110
- $this->main->permission_denied();
111
- return;
112
- }
113
-
114
- $this->users = get_users(array('exclude' => array(wp_get_current_user()->ID)));
115
-
116
- $roles = get_editable_roles();
117
-
118
- $this->primary_roles = array();
119
- foreach ($roles as $key => $value) {
120
- $this->primary_roles[$key] = $value['name'];
121
- }
122
- $this->primary_roles[''] = '&mdash;' . $this->__('No role for this site') . '&mdash;';
123
-
124
- $this->secondary_roles = array();
125
- foreach ($roles as $key => $value) {
126
- if ($key != 'administrator')
127
- $this->secondary_roles[$key] = $value['name'];
128
- }
129
-
130
- if (!empty($_POST['assignroles']) && !empty($_POST['assign-user'])) {
131
- $this->main->verify_nonce();
132
-
133
- $this->result = (OBJECT) array("success" => FALSE);
134
-
135
- $this->user = get_userdata($_POST['assign-user']);
136
- if ($this->user === FALSE || $this->user->ID === wp_get_current_user()->ID) {
137
- $this->user = NULL;
138
- $this->result->message = $this->__('Invalid user.');
139
- }
140
-
141
- if ($this->user != NULL) {
142
- $primary_role = NULL;
143
- if (isset($_POST['assign-primary-role'])) {
144
- $primary_role = $_POST['assign-primary-role'];
145
- if (!array_key_exists($primary_role, $this->primary_roles))
146
- $primary_role = NULL;
147
- }
148
-
149
- if ($primary_role !== NULL) {
150
- $secondary_roles = array();
151
- if (!empty($_POST['assign-secondary-roles'])) {
152
- $secondary_roles = $_POST['assign-secondary-roles'];
153
- }
154
- if (is_array($secondary_roles))
155
- $secondary_roles = array_keys($secondary_roles);
156
- else
157
- $secondary_roles = array();
158
-
159
- $this->user->set_role($primary_role);
160
-
161
- foreach ($secondary_roles as $role) {
162
- $this->user->add_role($role);
163
- }
164
-
165
- $this->result->success = TRUE;
166
- $this->result->message = $this->__('Roles updated successfully.');
167
- } else {
168
- $this->result->message = $this->__('Invalid primary role specified.');
169
- }
170
- }
171
- }
172
-
173
- if (!empty($_POST['migrateroles'])) {
174
- $this->main->verify_nonce();
175
-
176
- $this->result = (OBJECT) array("success" => FALSE);
177
-
178
- if (isset($_POST['migrate-from-primary-role'])) {
179
- $this->migrateFromPrimaryRole = $_POST['migrate-from-primary-role'];
180
- if (!array_key_exists($this->migrateFromPrimaryRole, $this->primary_roles)) {
181
- $this->migrateFromPrimaryRole = NULL;
182
- }
183
- }
184
-
185
- if ($this->migrateFromPrimaryRole === NULL) {
186
- $this->result->message = $this->__('Invalid primary role.');
187
- } else {
188
- if (isset($_POST['migrate-primary-role'])) {
189
- $this->migrateToPrimaryRole = $_POST['migrate-primary-role'];
190
- if (!array_key_exists($this->migrateToPrimaryRole, $this->primary_roles)) {
191
- $this->migrateToPrimaryRole = NULL;
192
- }
193
- }
194
-
195
- if ($this->migrateToPrimaryRole === NULL) {
196
- $this->result->message = $this->__('Invalid primary role.');
197
- } else {
198
- if (!empty($_POST['migrate-secondary-roles'])) {
199
- $this->migrateToSecondaryRoles = $_POST['migrate-secondary-roles'];
200
- if (is_array($this->migrateToSecondaryRoles))
201
- $this->migrateToSecondaryRoles = array_keys($this->migrateToSecondaryRoles);
202
- else
203
- $this->migrateToSecondaryRoles = array();
204
- }
205
-
206
- $users = get_users(array('exclude' => array(wp_get_current_user()->ID), 'role' => $this->migrateFromPrimaryRole));
207
- $users = array_filter($users, array($this, 'array_filter_user'));
208
-
209
- foreach ($users as $user) {
210
- $user->set_role($this->migrateToPrimaryRole);
211
-
212
- foreach ($this->migrateToSecondaryRoles as $role) {
213
- $user->add_role($role);
214
- }
215
- }
216
-
217
- $this->result->success = TRUE;
218
- $this->result->message = sprintf($this->__('%d user(s) migrated.'), count($users));
219
- }
220
- }
221
- }
222
-
223
- if ($this->user == NULL && !empty($_GET['assign_roles'])) {
224
- $this->user = get_userdata($_GET['assign_roles']);
225
- if ($this->user === FALSE || $this->user->ID === wp_get_current_user()->ID)
226
- $this->user = NULL;
227
- }
228
-
229
- if ($this->user == NULL) {
230
- if (!empty($this->users))
231
- $this->user = $this->users[0];
232
- }
233
-
234
- if ($this->user != NULL) {
235
- $roles = $this->user->roles;
236
- $this->userPrimaryRole = array_shift($roles);
237
- if ($this->userPrimaryRole === NULL)
238
- $this->userPrimaryRole = '';
239
- $this->userSecondaryRoles = $roles;
240
- }
241
-
242
- include($this->main->pluginDIR() . 'templates/assign-roles.php');
243
- }
244
-
245
- private function array_filter_user($user) {
246
- if ($this->migrateFromPrimaryRole === '') {
247
- if (empty($user->roles))
248
- return TRUE;
249
- }
250
-
251
- if (empty($user->roles))
252
- return FALSE;
253
-
254
- $roles = $user->roles;
255
- $role = array_shift($roles);
256
- return $role === $this->migrateFromPrimaryRole;
257
- }
258
-
259
- private function primary_secondary_section($prefix, $selectPrimaryRole = NULL, $selectSecondaryRoles = array()) {
260
- ?>
261
- <tr>
262
- <th scope="row">
263
- <?php echo $this->__('Primary Role'); ?>
264
- </th>
265
- <td>
266
- <select id="<?php echo $prefix; ?>_roles_list" name="<?php echo $prefix; ?>-primary-role">
267
- <?php
268
- foreach ($this->primary_roles as $key => $role) {
269
- ?>
270
- <option value="<?php echo $key; ?>" <?php echo $selectPrimaryRole === $key ? 'selected' : ''; ?>>
271
- <?php echo $role; ?>
272
-
273
- </option>
274
- <?php
275
- }
276
- ?>
277
- </select>
278
- </td>
279
- </tr>
280
- <tr>
281
- <th scope="row">
282
- <?php echo $this->__('Secondary Roles'); ?>
283
- </th>
284
- <td>
285
- <div class="role-list">
286
- <?php
287
- foreach ($this->secondary_roles as $key => $role) {
288
- ?>
289
- <div class="role-list-item">
290
- <label>
291
- <input type="checkbox" name="<?php echo $prefix; ?>-secondary-roles[<?php echo $key; ?>]" <?php echo in_array($key, $selectSecondaryRoles) ? 'checked' : ''; ?> />
292
- <?php echo $role; ?>
293
- </label>
294
- </div>
295
- <?php
296
- }
297
- ?>
298
- </div>
299
- </td>
300
- </tr>
301
- <?php
302
- }
303
-
304
- }
305
-
306
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
classes/class-wpfront-user-role-editor-delete.php CHANGED
@@ -79,7 +79,7 @@ if (!class_exists('WPFront_User_Role_Editor_Delete')) {
79
  remove_role($key);
80
  }
81
  }
82
- printf('<script type="text/javascript">window.location.replace("%s");</script>', $this->list_roles_url());
83
  return;
84
  }
85
 
79
  remove_role($key);
80
  }
81
  }
82
+ printf('<script type="text/javascript">document.location="%s";</script>', $this->list_roles_url());
83
  return;
84
  }
85
 
classes/class-wpfront-user-role-editor-list.php CHANGED
@@ -60,7 +60,7 @@ if (!class_exists('WPFront_User_Role_Editor_List')) {
60
 
61
  if (!empty($_GET['set_default_role'])) {
62
  $this->set_default_role($_GET['set_default_role']);
63
- printf('<script type="text/javascript">window.location.replace("%s");</script>', $this->list_url());
64
  return;
65
  }
66
 
@@ -280,10 +280,10 @@ if (!class_exists('WPFront_User_Role_Editor_List')) {
280
  }
281
 
282
  private function get_search_term() {
283
- if (empty($_POST['s']))
284
  return '';
285
 
286
- return $_POST['s'];
287
  }
288
 
289
  private function get_list_filters() {
60
 
61
  if (!empty($_GET['set_default_role'])) {
62
  $this->set_default_role($_GET['set_default_role']);
63
+ printf('<script type="text/javascript">document.location="%s";</script>', $this->list_url());
64
  return;
65
  }
66
 
280
  }
281
 
282
  private function get_search_term() {
283
+ if (empty($_POST['search']))
284
  return '';
285
 
286
+ return $_POST['search'];
287
  }
288
 
289
  private function get_list_filters() {
classes/class-wpfront-user-role-editor.php CHANGED
@@ -27,7 +27,6 @@ require_once("class-wpfront-user-role-editor-list.php");
27
  require_once("class-wpfront-user-role-editor-add-edit.php");
28
  require_once("class-wpfront-user-role-editor-delete.php");
29
  require_once("class-wpfront-user-role-editor-restore.php");
30
- require_once("class-wpfront-user-role-editor-assign-roles.php");
31
 
32
  if (!class_exists('WPFront_User_Role_Editor')) {
33
 
@@ -40,7 +39,7 @@ if (!class_exists('WPFront_User_Role_Editor')) {
40
  class WPFront_User_Role_Editor extends WPFront_Base {
41
 
42
  //Constants
43
- const VERSION = '1.3';
44
  const OPTIONS_GROUP_NAME = 'wpfront-user-role-editor-options-group';
45
  const OPTION_NAME = 'wpfront-user-role-editor-options';
46
  const PLUGIN_SLUG = 'wpfront-user-role-editor';
@@ -145,20 +144,11 @@ if (!class_exists('WPFront_User_Role_Editor')) {
145
  private static $CAPABILITIES = NULL;
146
  //Variables
147
  protected $options;
148
- protected $objList;
149
- protected $objAddEdit;
150
- protected $objRestore;
151
- protected $objAssignUsers;
152
 
153
  function __construct() {
154
  parent::__construct(__FILE__, self::PLUGIN_SLUG);
155
 
156
  $this->add_menu($this->__('WPFront User Role Editor'), $this->__('User Role Editor'));
157
-
158
- $this->objList = new WPFront_User_Role_Editor_List($this);
159
- $this->objAddEdit = new WPFront_User_Role_Editor_Add_Edit($this);
160
- $this->objRestore = new WPFront_User_Role_Editor_Restore($this);
161
- $this->objAssignUsers = new WPFront_User_Role_Editor_Assign_Roles($this);
162
  }
163
 
164
  public function plugins_loaded() {
@@ -175,8 +165,11 @@ if (!class_exists('WPFront_User_Role_Editor')) {
175
 
176
  add_action('wp_ajax_wpfront_user_role_editor_update_options', array($this, 'update_options_callback'));
177
 
178
- $this->objAddEdit->ajax_register();
179
- $this->objRestore->ajax_register();
 
 
 
180
  }
181
 
182
  public function admin_menu() {
@@ -185,19 +178,15 @@ if (!class_exists('WPFront_User_Role_Editor')) {
185
  $menu_slug = WPFront_User_Role_Editor_List::MENU_SLUG;
186
  add_menu_page($this->__('Roles'), $this->__('Roles'), $this->get_capability_string('list'), $menu_slug, null, $this->pluginURL() . 'images/roles_menu.png', '69.9999');
187
 
188
- $page_hook_suffix = add_submenu_page($menu_slug, $this->__('Roles'), $this->__('All Roles'), $this->get_capability_string('list'), $menu_slug, array($this->objList, 'list_roles'));
189
- add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
190
- add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
191
-
192
- $page_hook_suffix = add_submenu_page($menu_slug, $this->__('Add New Role'), $this->__('Add New'), $this->get_capability_string('create'), WPFront_User_Role_Editor_Add_Edit::MENU_SLUG, array($this->objAddEdit, 'add_edit_role'));
193
  add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
194
  add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
195
 
196
- $page_hook_suffix = add_submenu_page($menu_slug, $this->__('Restore Role'), $this->__('Restore'), $this->get_capability_string('edit'), WPFront_User_Role_Editor_Restore::MENU_SLUG, array($this->objRestore, 'restore_role'));
197
  add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
198
  add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
199
 
200
- $page_hook_suffix = add_users_page($this->__('Assign Roles | Migrate Users'), $this->__('Assign / Migrate'), 'promote_user', WPFront_User_Role_Editor_Assign_Roles::MENU_SLUG, array($this->objAssignUsers, 'assign_roles'));
201
  add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
202
  add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
203
  }
@@ -375,11 +364,11 @@ if (!class_exists('WPFront_User_Role_Editor')) {
375
  public function display_deprecated() {
376
  return $this->options->display_deprecated();
377
  }
378
-
379
  public function enable_role_capabilities() {
380
  return $this->options->enable_role_capabilities();
381
  }
382
-
383
  public function remove_nonstandard_capabilities_restore() {
384
  return $this->options->remove_nonstandard_capabilities_restore();
385
  }
27
  require_once("class-wpfront-user-role-editor-add-edit.php");
28
  require_once("class-wpfront-user-role-editor-delete.php");
29
  require_once("class-wpfront-user-role-editor-restore.php");
 
30
 
31
  if (!class_exists('WPFront_User_Role_Editor')) {
32
 
39
  class WPFront_User_Role_Editor extends WPFront_Base {
40
 
41
  //Constants
42
+ const VERSION = '1.2';
43
  const OPTIONS_GROUP_NAME = 'wpfront-user-role-editor-options-group';
44
  const OPTION_NAME = 'wpfront-user-role-editor-options';
45
  const PLUGIN_SLUG = 'wpfront-user-role-editor';
144
  private static $CAPABILITIES = NULL;
145
  //Variables
146
  protected $options;
 
 
 
 
147
 
148
  function __construct() {
149
  parent::__construct(__FILE__, self::PLUGIN_SLUG);
150
 
151
  $this->add_menu($this->__('WPFront User Role Editor'), $this->__('User Role Editor'));
 
 
 
 
 
152
  }
153
 
154
  public function plugins_loaded() {
165
 
166
  add_action('wp_ajax_wpfront_user_role_editor_update_options', array($this, 'update_options_callback'));
167
 
168
+ $add_new = new WPFront_User_Role_Editor_Add_Edit($this);
169
+ $add_new->ajax_register();
170
+
171
+ $restore = new WPFront_User_Role_Editor_Restore($this);
172
+ $restore->ajax_register();
173
  }
174
 
175
  public function admin_menu() {
178
  $menu_slug = WPFront_User_Role_Editor_List::MENU_SLUG;
179
  add_menu_page($this->__('Roles'), $this->__('Roles'), $this->get_capability_string('list'), $menu_slug, null, $this->pluginURL() . 'images/roles_menu.png', '69.9999');
180
 
181
+ $page_hook_suffix = add_submenu_page($menu_slug, $this->__('Roles'), $this->__('All Roles'), $this->get_capability_string('list'), $menu_slug, array(new WPFront_User_Role_Editor_List($this), 'list_roles'));
 
 
 
 
182
  add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
183
  add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
184
 
185
+ $page_hook_suffix = add_submenu_page($menu_slug, $this->__('Add New Role'), $this->__('Add New'), $this->get_capability_string('create'), WPFront_User_Role_Editor_Add_Edit::MENU_SLUG, array(new WPFront_User_Role_Editor_Add_Edit($this), 'add_edit_role'));
186
  add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
187
  add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
188
 
189
+ $page_hook_suffix = add_submenu_page($menu_slug, $this->__('Restore Role'), $this->__('Restore'), $this->get_capability_string('edit'), WPFront_User_Role_Editor_Restore::MENU_SLUG, array(new WPFront_User_Role_Editor_Restore($this), 'restore_role'));
190
  add_action('admin_print_scripts-' . $page_hook_suffix, array($this, 'enqueue_role_scripts'));
191
  add_action('admin_print_styles-' . $page_hook_suffix, array($this, 'enqueue_role_styles'));
192
  }
364
  public function display_deprecated() {
365
  return $this->options->display_deprecated();
366
  }
367
+
368
  public function enable_role_capabilities() {
369
  return $this->options->enable_role_capabilities();
370
  }
371
+
372
  public function remove_nonstandard_capabilities_restore() {
373
  return $this->options->remove_nonstandard_capabilities_restore();
374
  }
css/style.css CHANGED
@@ -103,6 +103,3 @@ div.role-restore table.form-table td div.restore-role-success {
103
  display: none;
104
  }
105
 
106
- div.wrap.assign-roles div.role-list div.role-list-item {
107
- padding-bottom: 5px;
108
- }
103
  display: none;
104
  }
105
 
 
 
 
languages/wpfront-user-role-editor.mo CHANGED
Binary file
languages/wpfront-user-role-editor.po CHANGED
@@ -1,8 +1,8 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WPFront Notification Bar\n"
4
- "POT-Creation-Date: 2014-08-16 12:20-0700\n"
5
- "PO-Revision-Date: 2014-08-16 12:20-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: WPFront <contact@wpfront.com>\n"
8
  "Language: en\n"
@@ -96,7 +96,7 @@ msgid "Activate"
96
  msgstr "Activate"
97
 
98
  #: ../classes/base/class-wpfront-base-menu.php:199
99
- #: ../classes/class-wpfront-user-role-editor.php:318
100
  msgid "Feedback"
101
  msgstr "Feedback"
102
 
@@ -109,7 +109,7 @@ msgid "All Plugins"
109
  msgstr "All Plugins"
110
 
111
  #: ../classes/base/class-wpfront-base.php:130
112
- #: ../classes/class-wpfront-user-role-editor.php:268
113
  msgid "You do not have sufficient permissions to access this page."
114
  msgstr "You do not have sufficient permissions to access this page."
115
 
@@ -153,46 +153,6 @@ msgstr "Buy me a Beer or Coffee"
153
  msgid "Save Changes"
154
  msgstr "Save Changes"
155
 
156
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:60
157
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:276
158
- msgid "Secondary Roles"
159
- msgstr "Secondary Roles"
160
-
161
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:75
162
- #: ../templates/assign-roles.php:36
163
- msgid "Assign Roles"
164
- msgstr "Assign Roles"
165
-
166
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:122
167
- msgid "No role for this site"
168
- msgstr "No role for this site"
169
-
170
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:138
171
- msgid "Invalid user."
172
- msgstr "Invalid user."
173
-
174
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:164
175
- msgid "Roles updated successfully."
176
- msgstr "Roles updated successfully."
177
-
178
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:166
179
- msgid "Invalid primary role specified."
180
- msgstr "Invalid primary role specified."
181
-
182
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:184
183
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:194
184
- msgid "Invalid primary role."
185
- msgstr "Invalid primary role."
186
-
187
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:214
188
- #, php-format
189
- msgid "%d user(s) migrated."
190
- msgstr "%d user(s) migrated."
191
-
192
- #: ../classes/class-wpfront-user-role-editor-assign-roles.php:257
193
- msgid "Primary Role"
194
- msgstr "Primary Role"
195
-
196
  #: ../classes/class-wpfront-user-role-editor-list.php:238
197
  #: ../templates/add-edit-role.php:111
198
  msgid "Select All"
@@ -283,53 +243,45 @@ msgstr "Remove Non-Standard Capabilities on Restore"
283
  msgid "ERROR"
284
  msgstr "ERROR"
285
 
286
- #: ../classes/class-wpfront-user-role-editor.php:156
287
  msgid "WPFront User Role Editor"
288
  msgstr "WPFront User Role Editor"
289
 
290
- #: ../classes/class-wpfront-user-role-editor.php:156
291
  msgid "User Role Editor"
292
  msgstr "User Role Editor"
293
 
294
- #: ../classes/class-wpfront-user-role-editor.php:186
295
- #: ../classes/class-wpfront-user-role-editor.php:188
296
  #: ../templates/list-roles.php:37
297
  msgid "Roles"
298
  msgstr "Roles"
299
 
300
- #: ../classes/class-wpfront-user-role-editor.php:188
301
  msgid "All Roles"
302
  msgstr "All Roles"
303
 
304
- #: ../classes/class-wpfront-user-role-editor.php:192
305
  #: ../templates/add-edit-role.php:35 ../templates/add-edit-role.php:154
306
  msgid "Add New Role"
307
  msgstr "Add New Role"
308
 
309
- #: ../classes/class-wpfront-user-role-editor.php:192
310
  #: ../templates/add-edit-role.php:37 ../templates/list-roles.php:40
311
  msgid "Add New"
312
  msgstr "Add New"
313
 
314
- #: ../classes/class-wpfront-user-role-editor.php:196
315
  #: ../templates/restore-role.php:34
316
  msgid "Restore Role"
317
  msgstr "Restore Role"
318
 
319
- #: ../classes/class-wpfront-user-role-editor.php:196
320
  #: ../templates/restore-role.php:46
321
  msgid "Restore"
322
  msgstr "Restore"
323
 
324
- #: ../classes/class-wpfront-user-role-editor.php:200
325
- msgid "Assign Roles | Migrate Users"
326
- msgstr "Assign Roles | Migrate Users"
327
-
328
- #: ../classes/class-wpfront-user-role-editor.php:200
329
- msgid "Assign / Migrate"
330
- msgstr "Assign / Migrate"
331
-
332
- #: ../classes/class-wpfront-user-role-editor.php:320
333
  msgid "Buy me a Beer"
334
  msgstr "Buy me a Beer"
335
 
@@ -365,18 +317,6 @@ msgstr "Select None"
365
  msgid "Update Role"
366
  msgstr "Update Role"
367
 
368
- #: ../templates/assign-roles.php:62
369
- msgid "User"
370
- msgstr "User"
371
-
372
- #: ../templates/assign-roles.php:93
373
- msgid "Migrate Users"
374
- msgstr "Migrate Users"
375
-
376
- #: ../templates/assign-roles.php:103
377
- msgid "From Primary Role"
378
- msgstr "From Primary Role"
379
-
380
  #: ../templates/delete-role.php:37
381
  msgid "Delete Roles"
382
  msgstr "Delete Roles"
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: WPFront Notification Bar\n"
4
+ "POT-Creation-Date: 2014-08-13 20:28-0700\n"
5
+ "PO-Revision-Date: 2014-08-13 20:28-0700\n"
6
  "Last-Translator: \n"
7
  "Language-Team: WPFront <contact@wpfront.com>\n"
8
  "Language: en\n"
96
  msgstr "Activate"
97
 
98
  #: ../classes/base/class-wpfront-base-menu.php:199
99
+ #: ../classes/class-wpfront-user-role-editor.php:307
100
  msgid "Feedback"
101
  msgstr "Feedback"
102
 
109
  msgstr "All Plugins"
110
 
111
  #: ../classes/base/class-wpfront-base.php:130
112
+ #: ../classes/class-wpfront-user-role-editor.php:257
113
  msgid "You do not have sufficient permissions to access this page."
114
  msgstr "You do not have sufficient permissions to access this page."
115
 
153
  msgid "Save Changes"
154
  msgstr "Save Changes"
155
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  #: ../classes/class-wpfront-user-role-editor-list.php:238
157
  #: ../templates/add-edit-role.php:111
158
  msgid "Select All"
243
  msgid "ERROR"
244
  msgstr "ERROR"
245
 
246
+ #: ../classes/class-wpfront-user-role-editor.php:151
247
  msgid "WPFront User Role Editor"
248
  msgstr "WPFront User Role Editor"
249
 
250
+ #: ../classes/class-wpfront-user-role-editor.php:151
251
  msgid "User Role Editor"
252
  msgstr "User Role Editor"
253
 
254
+ #: ../classes/class-wpfront-user-role-editor.php:179
255
+ #: ../classes/class-wpfront-user-role-editor.php:181
256
  #: ../templates/list-roles.php:37
257
  msgid "Roles"
258
  msgstr "Roles"
259
 
260
+ #: ../classes/class-wpfront-user-role-editor.php:181
261
  msgid "All Roles"
262
  msgstr "All Roles"
263
 
264
+ #: ../classes/class-wpfront-user-role-editor.php:185
265
  #: ../templates/add-edit-role.php:35 ../templates/add-edit-role.php:154
266
  msgid "Add New Role"
267
  msgstr "Add New Role"
268
 
269
+ #: ../classes/class-wpfront-user-role-editor.php:185
270
  #: ../templates/add-edit-role.php:37 ../templates/list-roles.php:40
271
  msgid "Add New"
272
  msgstr "Add New"
273
 
274
+ #: ../classes/class-wpfront-user-role-editor.php:189
275
  #: ../templates/restore-role.php:34
276
  msgid "Restore Role"
277
  msgstr "Restore Role"
278
 
279
+ #: ../classes/class-wpfront-user-role-editor.php:189
280
  #: ../templates/restore-role.php:46
281
  msgid "Restore"
282
  msgstr "Restore"
283
 
284
+ #: ../classes/class-wpfront-user-role-editor.php:309
 
 
 
 
 
 
 
 
285
  msgid "Buy me a Beer"
286
  msgstr "Buy me a Beer"
287
 
317
  msgid "Update Role"
318
  msgstr "Update Role"
319
 
 
 
 
 
 
 
 
 
 
 
 
 
320
  #: ../templates/delete-role.php:37
321
  msgid "Delete Roles"
322
  msgstr "Delete Roles"
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: syammohanm
3
  Donate link: http://wpfront.com/donate/
4
  Tags: user role editor, role editor, user role, role, user roles, roles, user roles editor, roles editor, role manager, roles manager, manage roles, manage role, access, capability, editor, permission, role, security, user, capability editor, capability manager
5
  Requires at least: 3.5
6
- Tested up to: 3.9.2
7
- Stable tag: 1.3
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -22,8 +22,6 @@ You can create, edit or delete user roles and manage role capabilities.
22
  * Allows you to add role capabilities.
23
  * Change default user role.
24
  * Restore role.
25
- * Assign multiple roles.
26
- * Migrate users.
27
 
28
  Visit [WPFront User Role Editor](http://wpfront.com/user-role-editor-plugin/) page for screens and functionalities.
29
 
@@ -55,10 +53,6 @@ Please visit [WPFront User Role Editor FAQ](http://wpfront.com/wordpress-plugins
55
 
56
  == Changelog ==
57
 
58
- = 1.3 =
59
- * Assign multiple roles
60
- * Migrate users
61
-
62
  = 1.2 =
63
  * Restore role
64
  * Bug fixes
@@ -78,10 +72,6 @@ Please visit [WPFront User Role Editor FAQ](http://wpfront.com/wordpress-plugins
78
 
79
  == Upgrade Notice ==
80
 
81
- = 1.3 =
82
- * Now you can assign multiple roles to a user
83
- * Migrate users from role to role
84
-
85
  = 1.2 =
86
  * Now you can restore roles
87
 
3
  Donate link: http://wpfront.com/donate/
4
  Tags: user role editor, role editor, user role, role, user roles, roles, user roles editor, roles editor, role manager, roles manager, manage roles, manage role, access, capability, editor, permission, role, security, user, capability editor, capability manager
5
  Requires at least: 3.5
6
+ Tested up to: 4.0
7
+ Stable tag: 1.2
8
  License: GPLv3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
22
  * Allows you to add role capabilities.
23
  * Change default user role.
24
  * Restore role.
 
 
25
 
26
  Visit [WPFront User Role Editor](http://wpfront.com/user-role-editor-plugin/) page for screens and functionalities.
27
 
53
 
54
  == Changelog ==
55
 
 
 
 
 
56
  = 1.2 =
57
  * Restore role
58
  * Bug fixes
72
 
73
  == Upgrade Notice ==
74
 
 
 
 
 
75
  = 1.2 =
76
  * Now you can restore roles
77
 
templates/assign-roles.php DELETED
@@ -1,154 +0,0 @@
1
- <?php
2
- /*
3
- WPFront User Role Editor Plugin
4
- Copyright (C) 2014, WPFront.com
5
- Website: wpfront.com
6
- Contact: syam@wpfront.com
7
-
8
- WPFront User Role Editor Plugin is distributed under the GNU General Public License, Version 3,
9
- June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
10
- St, Fifth Floor, Boston, MA 02110, USA
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
13
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
16
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
17
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
18
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
- */
23
-
24
- /**
25
- * Template for WPFront User Role Editor List Roles
26
- *
27
- * @author Syam Mohan <syam@wpfront.com>
28
- * @copyright 2014 WPFront.com
29
- */
30
- ?>
31
-
32
- <?php $this->main->verify_nonce(); ?>
33
-
34
- <div class="wrap assign-roles">
35
- <h2 id="assign-roles">
36
- <?php echo $this->__('Assign Roles'); ?>
37
- </h2>
38
-
39
- <?php
40
- if ($this->result != NULL) {
41
- if ($this->result->success) {
42
- ?>
43
- <div class="updated">
44
- <p><?php echo $this->result->message; ?></p>
45
- </div>
46
- <?php } else { ?>
47
-
48
- <div class="error">
49
- <p><?php echo $this->result->message; ?></p>
50
- </div>
51
- <?php
52
- }
53
- }
54
- ?>
55
-
56
- <form method="POST">
57
- <?php $this->main->create_nonce(); ?>
58
- <table class="form-table">
59
- <tbody>
60
- <tr>
61
- <th scope="row">
62
- <?php echo $this->__('User'); ?>
63
- </th>
64
- <td>
65
- <select id="assign_users_list" name="assign-user">
66
- <?php
67
- foreach ($this->users as $user) {
68
- $select = FALSE;
69
- if ($this->user != NULL && $this->user->ID == $user->ID)
70
- $select = TRUE;
71
- ?>
72
- <option <?php echo $select ? 'selected' : ''; ?> value="<?php echo $user->ID; ?>">
73
- <?php echo $user->display_name; ?>
74
- </option>
75
- <?php
76
- }
77
- ?>
78
- </select>
79
- </td>
80
- </tr>
81
-
82
- <?php $this->primary_secondary_section('assign', $this->userPrimaryRole, $this->userSecondaryRoles); ?>
83
-
84
- </tbody>
85
- </table>
86
-
87
- <p class="submit">
88
- <input type="submit" name="assignroles" id="assignroles" class="button button-primary" value="Assign Roles" />
89
- </p>
90
- </form>
91
-
92
- <h2 id="migrate-users">
93
- <?php echo $this->__('Migrate Users'); ?>
94
- </h2>
95
-
96
- <form method="POST">
97
- <?php $this->main->create_nonce(); ?>
98
-
99
- <table class="form-table">
100
- <tbody>
101
- <tr>
102
- <th scope="row">
103
- <?php echo $this->__('From Primary Role'); ?>
104
- </th>
105
- <td>
106
- <select id="migrate_from_role" name="migrate-from-primary-role">
107
- <?php
108
- foreach ($this->primary_roles as $key => $role) {
109
- ?>
110
- <option value="<?php echo $key; ?>" <?php echo $this->migrateFromPrimaryRole === $key ? 'selected' : ''; ?>>
111
- <?php echo $role; ?>
112
- </option>
113
- <?php
114
- }
115
- ?>
116
- </select>
117
- </td>
118
- </tr>
119
-
120
- <?php $this->primary_secondary_section('migrate', $this->migrateToPrimaryRole, $this->migrateToSecondaryRoles); ?>
121
-
122
- </tbody>
123
- </table>
124
-
125
- <p class="submit">
126
- <input type="submit" name="migrateroles" id="migrateroles" class="button button-primary" value="Migrate Users" />
127
- </p>
128
- </form>
129
-
130
- </div>
131
-
132
- <script type="text/javascript">
133
-
134
- (function($) {
135
-
136
- var page_url = '<?php echo $this->get_assign_role_url(); ?>';
137
-
138
- $('#assign_users_list').change(function() {
139
- window.location.replace(page_url + $(this).val());
140
- });
141
-
142
- $('#assign_roles_list, #migrate_roles_list').change(function() {
143
- var $this = $(this);
144
- if ($this.val() == '') {
145
- $this.closest('table').find('div.role-list-item input').prop('disabled', true);
146
- }
147
- else {
148
- $this.closest('table').find('div.role-list-item input').prop('disabled', false);
149
- }
150
- }).change();
151
-
152
- })(jQuery);
153
-
154
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
templates/list-roles.php CHANGED
@@ -60,7 +60,7 @@
60
  <?php $this->main->create_nonce(); ?>
61
  <p class = "search-box">
62
  <label class = "screen-reader-text" for = "role-search-input"><?php echo $this->__('Search Roles') . ':'; ?></label>
63
- <input type="search" id="role-search-input" name="s" value="<?php echo $this->get_search_term(); ?>">
64
  <input type="submit" name="search-submit" id="search-submit" class="button" value="<?php echo $this->__('Search Roles'); ?>">
65
  </p>
66
  <?php $this->bulk_actions('top'); ?>
60
  <?php $this->main->create_nonce(); ?>
61
  <p class = "search-box">
62
  <label class = "screen-reader-text" for = "role-search-input"><?php echo $this->__('Search Roles') . ':'; ?></label>
63
+ <input type="search" id="role-search-input" name="search" value="<?php echo $this->get_search_term(); ?>">
64
  <input type="submit" name="search-submit" id="search-submit" class="button" value="<?php echo $this->__('Search Roles'); ?>">
65
  </p>
66
  <?php $this->bulk_actions('top'); ?>
wpfront-user-role-editor.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WPFront User Role Editor
4
  * Plugin URI: http://wpfront.com/user-role-editor-plugin/
5
  * Description: Allows you to manage user roles.
6
- * Version: 1.3
7
  * Author: Syam Mohan
8
  * Author URI: http://wpfront.com
9
  * License: GPL v3
3
  * Plugin Name: WPFront User Role Editor
4
  * Plugin URI: http://wpfront.com/user-role-editor-plugin/
5
  * Description: Allows you to manage user roles.
6
+ * Version: 1.2
7
  * Author: Syam Mohan
8
  * Author URI: http://wpfront.com
9
  * License: GPL v3