prefix.'user_roles'; if (isset($_GET['action'])) { $action = $_GET['action']; // restore roles capabilities from the backup record if ($action=='reset') { $mess = restoreUserRoles(); } else if ($action=='addnewrole') { // process new role create request $mess = ure_newRoleCreate($currentRole); } else if ($action=='delete') { $mess = ure_deleteRole(); } else if ($action=='default') { $mess = ure_changeDefaultRole(); } else if ($action=='capsreadable') { if ($ure_caps_readable) { $ure_caps_readable = 0; } else { $ure_caps_readable = 1; } update_option('ure_caps_readable', $ure_caps_readable); } } $defaultRole = get_option('default_role'); if (!isset($roles) || !$roles) { // get roles data from database $roles = ure_getUserRoles(); if (!$roles) { return; } } $rolesId = array(); foreach ($roles as $key=>$value) { $rolesId[] = $key; } if (!isset($currentRole) || !$currentRole) { $currentRole = $rolesId[count($rolesId) - 1]; if (isset($_REQUEST['user_role']) && $_REQUEST['user_role']) { $currentRole = $_REQUEST['user_role']; } } $roleDefaultHTML = ''; foreach ($roles as $key=>$value) { $selected1 = ure_optionSelected($key, $currentRole); $selected2 = ure_optionSelected($key, $defaultRole); if ($key!='administrator') { $roleSelectHTML .= ''; $roleDefaultHTML .= ''; } } $roleSelectHTML .= ''; $roleDefaultHTML .= ''; $fullCapabilities = array(); $role = $roles['administrator']; foreach ($role['capabilities'] as $key=>$value) { $fullCapabilities[] = $key; } // save role changes to database block if (isset($_POST['action']) && $_POST['action']=='update' && isset($_POST['user_role'])) { $currentRole = $_POST['user_role']; $capabilityToSave = array(); foreach($roles['administrator']['capabilities'] as $availableCapability=>$value) { if (isset($_POST[$availableCapability])) { $capabilityToSave[$availableCapability] = 1; } } if (count($capabilityToSave)>0) { // check if backup user roles record exists already $backup_option_name = $wpdb->prefix.'backup_user_roles'; $query = "select option_id from $ure_OptionsTable where option_name='$backup_option_name' limit 0, 1"; $option_id = $wpdb->get_var($query); if ($wpdb->last_error) { ure_logEvent($wpdb->last_error, true); return; } if (!$option_id) { // create user roles record backup $serialized_roles = mysql_real_escape_string(serialize($roles)); $query = "insert into $ure_OptionsTable (option_name, option_value, autoload) values ('$backup_option_name', '$serialized_roles', 'yes')"; $record = $wpdb->query($query); if ($wpdb->last_error) { ure_logEvent($wpdb->last_error, true); return; } $mess .= __('Backup record is created for the current role capabilities', 'ure'); } $roles[$currentRole]['capabilities'] = $capabilityToSave; if (!ure_saveRolesToDb($roles)) { return; } if ($mess) { $mess .= '
'; } $mess = __('Role', 'ure').' '.__($roles[$currentRole]['name'], 'ure').' '.__('is updated successfully', 'ure'); } } $rolesCanDelete = getRolesCanDelete($roles); if ($rolesCanDelete && count($rolesCanDelete)>0) { $roleDeleteHTML = ''; } else { $roleDeleteHTML = ''; } // options page display part function ure_displayBoxStart($title, $style='') { ?>

/>

=$quantInColumn) { $quantInCell = 0; echo '
'; } } ?>

onclick="ure_Actions('capsreadable');"/>