本文整理汇总了PHP中remove_role函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_role函数的具体用法?PHP remove_role怎么用?PHP remove_role使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_role函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpTearDownAfterClass
public static function wpTearDownAfterClass() {
$ids = array( self::$editor_id, self::$grammarian_id );
foreach ( $ids as $id ) {
self::delete_user( $id );
}
remove_role( 'grammarian' );
}
示例2: sp_roles_and_caps
function sp_roles_and_caps()
{
// Office Manager Role
remove_role('office');
// in case we updated the caps below
add_role('office', 'Office Manager', array('read' => true, 'create_users' => true, 'delete_users' => true, 'edit_users' => true, 'list_users' => true, 'promote_users' => true, 'remove_users' => true, 'office_report' => true));
}
示例3: remove_roles
function remove_roles()
{
remove_role('subscriber');
remove_role('editor');
remove_role('contributor');
remove_role('author');
}
示例4: pd_remove_roles
function pd_remove_roles()
{
remove_role('basic_student');
remove_role('webinar_student');
remove_role('sponsor_member');
remove_role('pds_benefactor');
}
示例5: backupToolReset
/**
* Resets roles to WordPress defaults.
*
* @return void
*/
function backupToolReset()
{
check_admin_referer('capsman-reset-defaults');
require_once ABSPATH . 'wp-admin/includes/schema.php';
if (!function_exists('populate_roles')) {
ak_admin_error(__('Needed function to create default roles not found!', 'capsman-enhanced'));
return;
}
$roles = array_keys(ak_get_roles(true));
foreach ($roles as $role) {
remove_role($role);
}
populate_roles();
$this->cm->setAdminCapability();
$msg = __('Roles and Capabilities reset to WordPress defaults', 'capsman-enhanced');
if (function_exists('pp_populate_roles')) {
pp_populate_roles();
} else {
// force PP to repopulate roles
$pp_ver = get_option('pp_c_version', true);
if ($pp_ver && is_array($pp_ver)) {
$pp_ver['version'] = preg_match("/dev|alpha|beta|rc/i", $pp_ver['version']) ? '0.1-beta' : 0.1;
} else {
$pp_ver = array('version' => '0.1', 'db_version' => '1.0');
}
update_option('pp_c_version', $pp_ver);
delete_option('ppperm_added_role_caps_10beta');
}
ak_admin_notify($msg);
}
示例6: delete_roles
function delete_roles()
{
$remove_roles = array('author', 'contributor', 'subscriber', 'editor');
foreach ($remove_roles as $role) {
remove_role($role);
}
}
示例7: init
public static function init()
{
// remove all roles (except administrator);
global $wp_roles;
foreach ($wp_roles->roles as $role => $value) {
if ($role == 'administrator') {
continue;
}
remove_role($role);
}
// register all roles
foreach (RoleTaxonomy::getDomains() as $name => $label) {
// Add new taxonomy, make it hierarchical (like categories)
$labels = array('name' => _x($label, 'taxonomy general name'), 'singular_name' => _x($label, 'taxonomy singular name'), 'search_items' => __('Search Terms'), 'all_items' => __('All Terms'), 'parent_item' => __('Parent Term'), 'parent_item_colon' => __('Parent Term:'), 'edit_item' => __('Edit Term'), 'update_item' => __('Update Term'), 'add_new_item' => __('Add New Term'), 'new_item_name' => __('New Term'), 'menu_name' => __($label));
$args = array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'show_admin_column' => FALSE, 'query_var' => true, 'show_in_menu' => true, 'rewrite' => array('slug' => $name), 'public' => TRUE, 'meta_box_cb' => FALSE);
register_taxonomy($name, array('itemsc', 'itemmc', 'learnout'), $args);
// add_role ('author_' . $name, 'Author @ ' . $label, array(
// 'read' => true,
// 'edit_posts' => true,
// 'delete_posts' => true,
// ));
// prefix "a_" --> author
add_role('a_' . $name, 'Author @ ' . $label, array("delete_others_pages" => false, "delete_others_posts" => false, "delete_pages" => true, "delete_posts" => true, "delete_private_pages" => true, "delete_private_posts" => true, "delete_published_pages" => true, "delete_published_posts" => true, "edit_others_pages" => false, "edit_others_posts" => true, "edit_pages" => true, "edit_posts" => true, "edit_private_pages" => true, "edit_private_posts" => true, "edit_published_pages" => true, "edit_published_posts" => true, "manage_categories" => true, "manage_links" => true, "moderate_comments" => true, "publish_pages" => false, "publish_posts" => false, "read" => true, "read_private_pages" => true, "read_private_posts" => true, "unfiltered_html" => true, "upload_files" => true, "edit_items" => TRUE, "edit_others_items" => TRUE, "edit_published_items" => TRUE, "edit_private_items" => TRUE, "publish_items" => FALSE, "delete_items" => TRUE, "delete_others_items" => TRUE, "delete_published_items" => TRUE, "delete_private_items" => TRUE, "read_private_items" => TRUE, "edit_item" => TRUE, "delete_item" => TRUE, "read_item" => TRUE, "edit_learnouts" => TRUE, "edit_others_learnouts" => TRUE, "edit_published_learnouts" => TRUE, "edit_private_learnouts" => TRUE, "publish_learnouts" => TRUE, "delete_learnouts" => TRUE, "delete_others_learnouts" => TRUE, "delete_published_learnouts" => TRUE, "delete_private_learnouts" => TRUE, "read_private_learnouts" => TRUE, "edit_learnout" => TRUE, "delete_learnout" => TRUE, "read_learnout" => TRUE, "edit_reviews" => TRUE, "edit_others_reviews" => TRUE, "edit_published_reviews" => TRUE, "edit_private_reviews" => TRUE, "publish_reviews" => TRUE, "delete_reviews" => TRUE, "delete_others_reviews" => TRUE, "delete_published_reviews" => TRUE, "delete_private_reviews" => TRUE, "read_private_reviews" => TRUE, "edit_review" => TRUE, "delete_review" => TRUE, "read_review" => TRUE));
// prefix "e_" --> editor
add_role('e_' . $name, 'Editor @ ' . $label, array("delete_others_pages" => true, "delete_others_posts" => true, "delete_pages" => true, "delete_posts" => true, "delete_private_pages" => true, "delete_private_posts" => true, "delete_published_pages" => true, "delete_published_posts" => true, "edit_others_pages" => true, "edit_others_posts" => true, "edit_pages" => true, "edit_posts" => true, "edit_private_pages" => true, "edit_private_posts" => true, "edit_published_pages" => true, "edit_published_posts" => true, "manage_categories" => true, "manage_links" => true, "moderate_comments" => true, "publish_pages" => true, "publish_posts" => true, "read" => true, "read_private_pages" => true, "read_private_posts" => true, "unfiltered_html" => true, "upload_files" => true, "edit_items" => TRUE, "edit_others_items" => TRUE, "edit_published_items" => TRUE, "edit_private_items" => TRUE, "publish_items" => TRUE, "delete_items" => TRUE, "delete_others_items" => TRUE, "delete_published_items" => TRUE, "delete_private_items" => TRUE, "read_private_items" => TRUE, "edit_item" => TRUE, "delete_item" => TRUE, "read_item" => TRUE, "edit_learnouts" => TRUE, "edit_others_learnouts" => TRUE, "edit_published_learnouts" => TRUE, "edit_private_learnouts" => TRUE, "publish_learnouts" => TRUE, "delete_learnouts" => TRUE, "delete_others_learnouts" => TRUE, "delete_published_learnouts" => TRUE, "delete_private_learnouts" => TRUE, "read_private_learnouts" => TRUE, "edit_learnout" => TRUE, "delete_learnout" => TRUE, "read_learnout" => TRUE, "edit_reviews" => TRUE, "edit_others_reviews" => TRUE, "edit_published_reviews" => TRUE, "edit_private_reviews" => TRUE, "publish_reviews" => TRUE, "delete_reviews" => TRUE, "delete_others_reviews" => TRUE, "delete_published_reviews" => TRUE, "delete_private_reviews" => TRUE, "read_private_reviews" => TRUE, "edit_review" => TRUE, "delete_review" => TRUE, "read_review" => TRUE));
}
// make sure that there is one current role
$user = wp_get_current_user();
$current_role = get_user_meta($user->ID, 'current_role', true);
if (!in_array($current_role, $user->roles)) {
if (count($user->roles) > 0) {
update_user_meta($user->ID, 'current_role', array_values($user->roles)[0]);
}
}
}
示例8: add_new_roles
/**
* Add the new Vendor role
*
* @return bool
*/
private function add_new_roles()
{
remove_role('pending_vendor');
add_role('pending_vendor', __('Pending Vendor', 'wcvendors'), array('read' => true, 'edit_posts' => false, 'delete_posts' => false));
remove_role('vendor');
add_role('vendor', __('Vendor', 'wcvendors'), array('assign_product_terms' => true, 'edit_products' => true, 'edit_product' => true, 'edit_published_products' => false, 'manage_product' => true, 'publish_products' => false, 'read' => true, 'upload_files' => true, 'view_woocommerce_reports' => true));
}
示例9: init
function init()
{
$this->helper->include_dir('classes');
$this->helper->update_country_list();
if (is_admin()) {
$this->helper->include_dir('admin');
}
$this->register_snap_post_type();
register_nav_menus(array('top_header_member_page' => __('Top Header in Member page', _NP_TEXT_DOMAIN)));
/**
* hook for parse request.
*/
add_action('init', array($this, 'add_rewrite'));
add_filter('query_vars', array($this, 'add_query_vars'), 0);
add_action('parse_request', array($this, 'handle_jobsshopper_requests'), 0);
/**
* hook for user log
*/
add_action('wp_login_failed', array('JS_User', 'login_fail'));
add_filter('authenticate', array('JS_User', 'allow_email_login'), 20, 3);
add_filter('authenticate', array('JS_User', 'check_avai_role_area'), 21, 3);
add_action('wp_logout', array('JS_User', 'user_logout'));
/**
* remove the roles which is not admin.
*/
remove_role('subscriber');
remove_role('basic_contributor');
remove_role('contributor');
remove_role('author');
remove_role('editor');
/**
* ajax function
*/
add_action('wp_ajax_get_timesnaps', array($this, 'ajax_get_timesnaps'));
add_action('wp_ajax_get_jobs', array($this, 'ajax_get_jobs'));
add_action('wp_ajax_delete_timesnaps', array($this, 'ajax_delete_timesnaps'));
add_action('wp_ajax_snap_applicant', array($this, 'ajax_snap_applicant'));
add_action('wp_ajax_reject_applicant', array($this, 'ajax_reject_applicant'));
add_action('wp_ajax_save_job', array($this, 'ajax_save_job'));
add_action('wp_ajax_snap_job', array($this, 'ajax_snap_job'));
add_action('wp_ajax_save_profile', array($this, 'ajax_save_profile'));
add_action('wp_ajax_unsave_item', array($this, 'ajax_unsave_item'));
add_action('wp_ajax_update_profile', array($this, 'ajax_update_profile'));
add_action('wp_ajax_upload_cover_image', array($this, 'ajax_upload_cover_image'));
add_action('wp_ajax_create_review', array($this, 'ajax_send_review'));
add_action('wp_ajax_reply_message', array($this, 'ajax_reply_message'));
add_action('wp_ajax_delete_message', array($this, 'ajax_delete_message'));
/**
* add jobs shop user roles
*/
add_role('jobsshopper', __('Jobs Shopper'), array('read' => true, 'edit_posts' => true, 'delete_posts' => true));
add_role('jobsboss', __('Jobs Boss'), array('read' => true, 'edit_posts' => true, 'delete_posts' => true));
/**
* Add package type
*/
wp_insert_term('Job Package', 'package_type');
wp_insert_term('Jobsshopper Package', 'package_type');
$this->create_db_table();
}
示例10: sc_chat_update_op_role
/**
* Create / Update operator role
*
* @access public
* @return void
*/
function sc_chat_update_op_role($role)
{
// First clean rol
remove_role('sc_chat_op');
// Create operator role
$op_role = add_role('sc_chat_op', __('Chat Operator', 'sc_chat'));
// Add common operator capability
$op_role->add_cap('chat_with_users');
switch ($role) {
/**
* N/A
*/
case 'none':
$op_role->add_cap('read');
break;
/**
* Editor
*/
/**
* Editor
*/
case 'editor':
// Get editor role
$editor = get_role('editor');
// Add editor caps to chat operator
foreach ($editor->capabilities as $custom_role => $v) {
$op_role->add_cap($custom_role);
}
break;
/**
* Author
*/
/**
* Author
*/
case 'author':
// Get author role
$author = get_role('author');
// Add editor caps to chat operator
foreach ($author->capabilities as $custom_role => $v) {
$op_role->add_cap($custom_role);
}
break;
/**
* Contributor
*/
/**
* Contributor
*/
case 'contributor':
// Get author role
$contributor = get_role('contributor');
// Add editor caps to chat operator
foreach ($contributor->capabilities as $custom_role => $v) {
$op_role->add_cap($custom_role);
}
break;
}
}
示例11: __construct
public function __construct(SLN_Plugin $plugin, $role, $displayName)
{
$this->plugin = $plugin;
$this->role = $role;
$this->displayName = $displayName;
remove_role($this->role);
add_role($this->role, $this->displayName, $this->capabilities);
}
示例12: add_roles_on_plugin_activation
function add_roles_on_plugin_activation()
{
add_role('instructor', 'Instructor', array('read' => true, 'edit' => true, 'delete' => false, 'level_0' => true));
remove_role('employee');
remove_role('contributor');
remove_role('subscriber');
remove_role('author');
}
示例13: __construct
/**
* Constructor. Load modules, check activation hook and remove the role
* (since we have no uninstall hook) if the feature is no longer set
*
* @since 0.0.1
* @access public
* @uses register_activation_hook()
* @uses remove_role()
*/
public function __construct()
{
$this->loadModules();
register_activation_hook(__FILE__, [$this, 'activate']);
if (!static::isThemeFeature('square-extra-user')) {
remove_role('square-manager');
}
}
示例14: cleanupUserRole
private function cleanupUserRole()
{
$adminRole = get_role('administrator');
$adminRole->remove_cap('chamame_chat_with_visitor');
$adminRole->remove_cap('chamame_view_chat_log');
$adminRole->remove_cap('chamame_edit_chat_options');
remove_role('chamameOperator');
}
示例15: removeCustomRole
/**
* Remove custom user role.
*
* @param $roleKey
*
* @since 1.0.0
*/
public function removeCustomRole( $roleKey ) {
do_action( 'wwp_action_before_remove_custom_role' , $roleKey );
remove_role( $roleKey );
do_action( 'wwp_action_after_remove_custom_role' , $roleKey );
}