for ($i; $i < $checks_per_row; $i++) { echo '<td> </td>'; } echo '</tr>'; } } ?> <tr class="cme-bulk-select"> <td colspan="<?php echo $checks_per_row; ?> "> <span> <?php $level = ak_caps2level($rcaps); ?> <?php _e('Level:', $this->ID); ?> <select name="level"> <?php for ($l = $this->max_level; $l >= 0; $l--) { ?> <option value="<?php echo $l; ?> " style="text-align:right;"<?php selected($level, $l); ?> > <?php
/** * Generates an array with the user capability names. * If user has 'administrator' role, system roles are generated. * The key is the capability and the value the created screen name. * A user cannot manage more capabilities that has himself (Except for administrators). * * @uses self::_capNamesCB() * @return void */ function generateNames() { if (current_user_can('administrator') || is_multisite() && is_super_admin()) { $this->generateSysNames(); } else { global $user_ID; $user = new WP_User($user_ID); $this->max_level = ak_caps2level($user->allcaps); $keys = array_keys($user->allcaps); $names = array_map(array($this, '_capNamesCB'), $keys); $this->capabilities = $keys ? array_combine($keys, $names) : array(); $roles = ak_get_roles(true); unset($roles['administrator']); if (defined('CME_LEGACY_USER_EDIT_FILTER') && CME_LEGACY_USER_EDIT_FILTER || !empty($_REQUEST['page']) && 'capsman' == $_REQUEST['page']) { foreach ($user->roles as $role) { // Unset the roles from capability list. unset($this->capabilities[$role]); unset($roles[$role]); // User cannot manage his roles. } } asort($this->capabilities); foreach (array_keys($roles) as $role) { $r = get_role($role); $level = ak_caps2level($r->capabilities); if ($level > $this->max_level) { unset($roles[$role]); } } $this->roles = $roles; } }
/** * Generates an array with the user capability names. * If user has 'administrator' role, system roles are generated. * The key is the capability and the value the created screen name. * A user cannot manage more capabilities that has himself (Except for administrators). * * @uses self::_capNamesCB() * @return void */ function generateNames() { if (current_user_can('administrator') || is_super_admin()) { $this->generateSysNames(); } else { global $user_ID; $user = new WP_User($user_ID); $this->max_level = ak_caps2level($user->allcaps); $keys = array_keys($user->allcaps); $names = array_map(array($this, '_capNamesCB'), $keys); $this->capabilities = $keys ? array_combine($keys, $names) : array(); $roles = ak_get_roles(true); unset($roles['administrator']); foreach ($user->roles as $role) { // Unset the roles from capability list. unset($this->capabilities[$role]); unset($roles[$role]); // User cannot manage his roles. } asort($this->capabilities); foreach (array_keys($roles) as $role) { $r = get_role($role); $level = ak_caps2level($r->capabilities); if ($level > $this->max_level) { unset($roles[$role]); } } $this->roles = $roles; } }