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


PHP WP_Roles::remove_cap方法代码示例

本文整理汇总了PHP中WP_Roles::remove_cap方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Roles::remove_cap方法的具体用法?PHP WP_Roles::remove_cap怎么用?PHP WP_Roles::remove_cap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Roles的用法示例。


在下文中一共展示了WP_Roles::remove_cap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

 /**
  * Adds plugin-specific caps to all roles so that 3rd party plugins can manage them
  */
 function add_caps()
 {
     $version = get_option('post_forking_cap_version');
     // Bail Early if we have already set the caps and aren't updating them
     if ($version !== false && $this->cap_version <= (int) $version) {
         return;
     }
     add_option('post_forking_cap_version', $this->cap_version, '', 'yes');
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     foreach ($wp_roles->role_names as $role => $label) {
         //if the role is a standard role, map the default caps, otherwise, map as a subscriber
         $caps = array_key_exists($role, $this->defaults) ? $this->defaults[$role] : $this->defaults['subscriber'];
         //loop and assign
         foreach ($caps as $cap => $grant) {
             //check to see if the user already has this capability, if so, don't re-add as that would override grant
             if (!isset($wp_roles->roles[$role]['capabilities'][$cap])) {
                 $wp_roles->add_cap($role, $cap, $grant);
             } else {
                 $wp_roles->remove_cap($role, $cap);
                 $wp_roles->add_cap($role, $cap, $grant);
             }
         }
     }
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:30,代码来源:capabilities.php

示例2: handle_rhc_uninstall

function handle_rhc_uninstall()
{
    $WP_Roles = new WP_Roles();
    foreach (array('calendarize_author', 'edit_' . RHC_CAPABILITY_TYPE, 'read_' . RHC_CAPABILITY_TYPE, 'delete_' . RHC_CAPABILITY_TYPE, 'edit_' . RHC_CAPABILITY_TYPE . 's', 'edit_others_' . RHC_CAPABILITY_TYPE . 's', 'edit_published_' . RHC_CAPABILITY_TYPE . 's', 'delete_published_' . RHC_CAPABILITY_TYPE . 's', 'delete_private_' . RHC_CAPABILITY_TYPE . 's', 'delete_others_' . RHC_CAPABILITY_TYPE . 's', 'publish_' . RHC_CAPABILITY_TYPE . 's', 'read_private_' . RHC_CAPABILITY_TYPE . 's', 'manage_' . RHC_VENUE, 'manage_' . RHC_CALENDAR, 'manage_' . RHC_ORGANIZER) as $cap) {
        $WP_Roles->remove_cap(RHC_ADMIN_ROLE, $cap);
    }
    //-----
}
开发者ID:TheMysticalSock,项目名称:westmichigansymphony,代码行数:8,代码来源:install.php

示例3: wlb_uninstall

function wlb_uninstall()
{
    $WP_Roles = new WP_Roles();
    foreach (array('wlb_branding', 'wlb_navigation', 'wlb_login', 'wlb_color_scheme', 'wlb_options', 'wlb_role_manager', 'wlb_license', 'wlb_downloads', 'wlb_dashboard_tool') as $cap) {
        $WP_Roles->remove_cap(WLB_ADMIN_ROLE, $cap);
    }
    //-----
}
开发者ID:emjayoh,项目名称:bhag,代码行数:8,代码来源:white-label-branding.php

示例4: handle_rhc_uninstall

function handle_rhc_uninstall()
{
    $WP_Roles = new WP_Roles();
    foreach (array('calendarize_author', 'edit_' . RHC_CAPABILITY_TYPE, 'read_' . RHC_CAPABILITY_TYPE, 'delete_' . RHC_CAPABILITY_TYPE, 'delete_' . RHC_CAPABILITY_TYPE . 's', 'edit_' . RHC_CAPABILITY_TYPE . 's', 'edit_others_' . RHC_CAPABILITY_TYPE . 's', 'edit_published_' . RHC_CAPABILITY_TYPE . 's', 'delete_published_' . RHC_CAPABILITY_TYPE . 's', 'delete_private_' . RHC_CAPABILITY_TYPE . 's', 'delete_others_' . RHC_CAPABILITY_TYPE . 's', 'publish_' . RHC_CAPABILITY_TYPE . 's', 'read_private_' . RHC_CAPABILITY_TYPE . 's', 'manage_' . RHC_VENUE, 'manage_' . RHC_CALENDAR, 'manage_' . RHC_ORGANIZER) as $cap) {
        $WP_Roles->remove_cap(RHC_ADMIN_ROLE, $cap);
    }
    //-----
    delete_site_transient('update_plugins');
    delete_option('rhc_dismiss_help_notice');
    $filename = get_home_path() . '.htaccess';
    if (file_exists($filename)) {
        insert_with_markers($filename, 'RHC', array());
    }
}
开发者ID:kaydwithers,项目名称:crossfittanjongpagar,代码行数:14,代码来源:install.php

示例5: disable_all_caps

 public function disable_all_caps()
 {
     global $wp_roles;
     if (!isset($wp_roles) || !is_object($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $ddl_capabilities = array_keys(self::ddl_get_capabilities());
     foreach ($ddl_capabilities as $cap) {
         foreach (array_keys($wp_roles->roles) as $role) {
             $wp_roles->remove_cap($role, $cap);
         }
     }
     //Remove caps for all Super Admins
     $super_admins = get_super_admins();
     foreach ($super_admins as $admin) {
         $user = new WP_User($admin);
         for ($i = 0, $caps_limit = count($ddl_capabilities); $i < $caps_limit; $i++) {
             $user->remove_cap($ddl_capabilities[$i]);
         }
     }
     $this->ddl_users_settings->update_options('updated_profiles', false, true);
 }
开发者ID:javierdlahoz,项目名称:paella-development,代码行数:22,代码来源:wpddl.user-profiles.class.php

示例6: un_deactivation_hook

function un_deactivation_hook()
{
    delete_option('un_version');
    global $wp_roles;
    if (!isset($wp_roles)) {
        $wp_roles = new WP_Roles();
    }
    foreach (un_get_capable_roles() as $role) {
        foreach (un_get_feedback_capabilities() as $cap) {
            $wp_roles->remove_cap($role, $cap);
        }
    }
    flush_rewrite_rules();
}
开发者ID:congtrieu112,项目名称:anime,代码行数:14,代码来源:usernoise.php

示例7: disable_all_caps

 public function disable_all_caps()
 {
     global $wp_roles;
     if (!isset($wp_roles) || !is_object($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $wpcf_capabilities = array_keys(self::wpcf_get_capabilities());
     foreach ($wpcf_capabilities as $cap) {
         foreach (array_keys($wp_roles->roles) as $role) {
             $wp_roles->remove_cap($role, $cap);
         }
     }
     //Remove caps for all Super Admins
     $super_admins = get_super_admins();
     foreach ($super_admins as $admin) {
         $user = new WP_User($admin);
         for ($i = 0, $caps_limit = count($wpcf_capabilities); $i < $caps_limit; $i++) {
             $user->remove_cap($wpcf_capabilities[$i]);
         }
     }
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:21,代码来源:class.wpcf.roles.php

示例8: rbhn_role_caps_uninstall

function rbhn_role_caps_uninstall( $role_key ) {

	$post_types_array = get_option( 'rbhn_post_types' );
	
    if ( ! empty( $post_types_array ) ) {
	    foreach( $post_types_array as $array ) {
			
			foreach( $array as $active_role=>$active_posttype ) {

				if ( $role_key == $active_role ) {
					$role = get_role( $active_role );
					$capability_type = $active_posttype;
				}
			}
		}
	}
	
	// if no post type found drop out.
	if ( empty( $capability_type ) )
		return;

	$delete_caps = array(
			"edit_{$capability_type}",
			"read_{$capability_type}",
			"delete_{$capability_type}",
			"edit_{$capability_type}s",
			"edit_others_{$capability_type}s",
			"publish_{$capability_type}s",
			"read_private_{$capability_type}s",
			"delete_{$capability_type}s",
			"delete_private_{$capability_type}s",
			"delete_published_{$capability_type}s",
			"delete_others_{$capability_type}s",
			"edit_private_{$capability_type}s",
			"edit_published_{$capability_type}s",
			"create_{$capability_type}s",
			"manage_categories_{$capability_type}"		
			);

    global $wp_roles;
 
    if ( ! isset( $wp_roles ) ) {
        $wp_roles = new WP_Roles( );
	}
		
	$users = get_users( );
	$administrator      = get_role( 'administrator' );
	
	// loop through the capability list.
	foreach ( $delete_caps as $cap ) {

		// Clean-up Capability from WordPress Roles
		foreach ( array_keys( $wp_roles->roles ) as $role ) {
			$wp_roles->remove_cap( $role, $cap );
		}
		
		// Clean-up Capability from WordPress Users where explicitly allocated 
		foreach ( $users as $user ) {
			$user->remove_cap( $cap );
		}

		// Clean-up Capability from the Administrator Role
		$administrator->remove_cap( $cap );		
	}
	unset( $wp_roles );
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:66,代码来源:uninstall.php

示例9: foreach

    /* @TODO: delete all transient, options and files you may have added
    	  delete_transient( 'TRANSIENT_NAME' );
    	  delete_option('OPTION_NAME');
    	  //info: remove custom file directory for main site
    	  $upload_dir = wp_upload_dir();
    	  $directory = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . "CUSTOM_DIRECTORY_NAME" . DIRECTORY_SEPARATOR;
    	  if (is_dir($directory)) {
    	  foreach(glob($directory.'*.*') as $v){
    	  unlink($v);
    	  }
    	  rmdir($directory);
    	  }
    	  //info: remove and optimize tables
    	  $GLOBALS['wpdb']->query("DROP TABLE `".$GLOBALS['wpdb']->prefix."TABLE_NAME`");
    	  $GLOBALS['wpdb']->query("OPTIMIZE TABLE `" .$GLOBALS['wpdb']->prefix."options`");
    	 */
    if (!isset($wp_roles)) {
        $wp_roles = new WP_Roles();
    }
    foreach ($wp_roles->role_names as $role => $label) {
        //if the role is a standard role, map the default caps, otherwise, map as a subscriber
        $caps = array_key_exists($role, $plugin_roles) ? $plugin_roles[$role] : $plugin_roles['subscriber'];
        //loop and assign
        foreach ($caps as $cap => $grant) {
            //check to see if the user already has this capability, if so, don't re-add as that would override grant
            if (!isset($wp_roles->roles[$role]['capabilities'][$cap])) {
                $wp_roles->remove_cap($cap);
            }
        }
    }
}
开发者ID:ncross42,项目名称:dobalance,代码行数:31,代码来源:uninstall.php

示例10:

 function duplicate_roles_for_new_blog($blog_id, $user_id)
 {
     global $wpdb, $global, $wp_roles;
     // get Id of 1st (main) blog
     $blogIds = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM {$wpdb->blogs} order by blog_id asc"));
     if (!isset($blogIds[0])) {
         return;
     }
     $current_blog = $wpdb->blogid;
     switch_to_blog($blogIds[0]);
     $main_roles = new WP_Roles();
     // get roles from primary blog
     $default_role = get_option('default_role');
     // get default role from primary blog
     switch_to_blog($blog_id);
     // switch to the new created blog
     $main_roles->use_db = false;
     // do not touch DB
     $main_roles->add_cap('administrator', 'dummy_123456');
     // just to save current roles into new blog
     $main_roles->role_key = $wp_roles->role_key;
     $main_roles->use_db = true;
     // save roles into new blog DB
     $main_roles->remove_cap('administrator', 'dummy_123456');
     // remove unneeded dummy capability
     update_option('default_role', $default_role);
     // set default role for new blog as it set for primary one
     switch_to_blog($current_blog);
     // return to blog where we were at the begin
 }
开发者ID:par-orillonsoft,项目名称:creationOfSociety,代码行数:30,代码来源:user-role-editor.php

示例11: foreach

 /**
  * Remove capabilities when a term is removed
  * @param unknown $term
  */
 function remove_caps($term)
 {
     $term_obj = get_term($term, $this->taxonomy);
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     foreach ($wp_roles->role_names as $role => $label) {
         foreach ($this->base_caps as $base_cap) {
             $wp_roles->remove_cap($role, $base_cap . '_in_' . $term_obj->slug);
         }
     }
 }
开发者ID:m-e-h,项目名称:WP-Document-Revisions-Code-Cookbook,代码行数:17,代码来源:taxonomy-permissions.php

示例12: removeCapability

	public function removeCapability($role, $cap)
	{
		global $wp_roles;
		
		/* 
		 * Check to make sure $wp_roles has been initialized and set.
		 * If it hasn't it is initialized. This was done because this method 
		 * can be called before the $wp_roles has been initialized.
		 */
		if (!isset($wp_roles))
		{
			$wp_roles = new WP_Roles();
		}
		
		//$wpRole = get_role($role);
		if ($this->hasCapability($role, $cap)) $wp_roles->remove_cap($role, $cap);
	}
开发者ID:realfluid,项目名称:umbaugh,代码行数:17,代码来源:class.options.php

示例13: remove_roles

 /**
  * Delete the roles and capabilities created by FUE
  */
 public function remove_roles()
 {
     global $wp_roles;
     if (class_exists('WP_Roles')) {
         if (!isset($wp_roles)) {
             $wp_roles = new WP_Roles();
         }
     }
     $capabilities = self::get_core_capabilities();
     foreach ($capabilities as $cap_group) {
         foreach ($cap_group as $cap) {
             $wp_roles->remove_cap('fue_manager', $cap);
             $wp_roles->remove_cap('administrator', $cap);
         }
     }
     remove_role('fue_manager');
 }
开发者ID:bself,项目名称:nuimage-wp,代码行数:20,代码来源:class-fue-install.php

示例14: etm_uninstall_capabilities

function etm_uninstall_capabilities()
{
    $caps = array();
    $caps[] = 'etm_show_menu';
    $caps[] = 'etm_translate_addon';
    $caps[] = 'etm_translate_post';
    $caps[] = 'etm_translate_category';
    $caps[] = 'etm_translate_post_tag';
    $caps[] = 'etm_translate_page';
    $caps[] = 'etm_translate_menu';
    $caps[] = 'etm_translate_seo';
    $caps[] = 'etm_translate_theme';
    $caps[] = 'etm_translate_plugin';
    $caps[] = 'etm_options';
    $caps[] = 'etm_license';
    $caps[] = 'etm_string_create';
    $caps[] = 'etm_view_addon';
    $caps[] = 'etm_view_post';
    $caps[] = 'etm_view_page';
    $caps[] = 'etm_view_seo';
    $caps[] = 'etm_view_menu';
    $caps[] = 'etm_view_theme';
    $caps[] = 'etm_view_plugin';
    $caps[] = 'etm_view_site_options';
    $caps[] = 'etm_translate_site_options';
    //--
    $WP_Roles = new WP_Roles();
    foreach ($caps as $cap) {
        $WP_Roles->remove_cap('administrator', $cap);
    }
    update_option('etm_options_plugin_tran', '');
    update_option('etm_options_install', '');
}
开发者ID:pcco,项目名称:portal-redesign,代码行数:33,代码来源:fn.install.php

示例15: deactivate

 /**
  * Deactivate the plugin
  */
 public static function deactivate()
 {
     $WP_Roles = new WP_Roles();
     foreach (array('chronosly_author', 'edit_' . CHRONOSLY_CAPABILITY_TYPE, 'read_' . CHRONOSLY_CAPABILITY_TYPE, 'delete_' . CHRONOSLY_CAPABILITY_TYPE, 'delete_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'edit_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'edit_others_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'edit_published_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'delete_published_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'delete_private_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'delete_others_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'publish_' . CHRONOSLY_CAPABILITY_TYPE . 's', 'read_private_' . CHRONOSLY_CAPABILITY_TYPE . 's') as $cap) {
         $WP_Roles->remove_cap(CHRONOSLY_ADMIN_ROLE, $cap);
     }
     delete_option("chronosly-settings");
     wp_clear_scheduled_hook('chronosly_update_addons');
     wp_clear_scheduled_hook('chronosly_update_templates');
 }
开发者ID:3GA,项目名称:chronosly-events-calendar,代码行数:13,代码来源:chronosly.php


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