当前位置: 首页>>代码示例>>PHP>>正文


PHP remove_role函数代码示例

本文整理汇总了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' );
	}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:7,代码来源:post.php

示例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));
}
开发者ID:Cywaithaka,项目名称:bwawwp,代码行数:7,代码来源:example-19.php

示例3: remove_roles

function remove_roles()
{
    remove_role('subscriber');
    remove_role('editor');
    remove_role('contributor');
    remove_role('author');
}
开发者ID:vhenrique,项目名称:CRUD---Estoque-PHP-WP,代码行数:7,代码来源:custom-functions.php

示例4: pd_remove_roles

function pd_remove_roles()
{
    remove_role('basic_student');
    remove_role('webinar_student');
    remove_role('sponsor_member');
    remove_role('pds_benefactor');
}
开发者ID:realbig,项目名称:PL_PEACEFULDRAGON_ROLES,代码行数:7,代码来源:peaceful-dragon-roles.php

示例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);
 }
开发者ID:akshayxhtmljunkies,项目名称:brownglock,代码行数:35,代码来源:backup-handler.php

示例6: delete_roles

function delete_roles()
{
    $remove_roles = array('author', 'contributor', 'subscriber', 'editor');
    foreach ($remove_roles as $role) {
        remove_role($role);
    }
}
开发者ID:ryanshoover,项目名称:seufolios,代码行数:7,代码来源:role_setup.php

示例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]);
         }
     }
 }
开发者ID:andreas-thor,项目名称:eal,代码行数:35,代码来源:class.CLA_RoleTaxonomy.php

示例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));
 }
开发者ID:stodorovic,项目名称:wcvendors,代码行数:12,代码来源:class-install.php

示例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();
 }
开发者ID:quangnpd,项目名称:jobshop_web,代码行数:59,代码来源:snapjobs.php

示例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;
    }
}
开发者ID:ardiqghenatya,项目名称:mavinnew,代码行数:65,代码来源:fn.admin.php

示例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);
 }
开发者ID:udaykanthgummadi,项目名称:salon-booking-system,代码行数:8,代码来源:SalonStaff.php

示例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');
}
开发者ID:csteines,项目名称:Complete-Training-Plugin,代码行数:8,代码来源:user-functions.php

示例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');
     }
 }
开发者ID:formwerdung,项目名称:square,代码行数:17,代码来源:modules.php

示例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');
 }
开发者ID:al-mamun,项目名称:chamame-live-chat,代码行数:8,代码来源:ChamameInstaller.php

示例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 );

    }
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:16,代码来源:class-wwp-wholesale-roles.php


注:本文中的remove_role函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。