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


PHP WP_Roles::get_names方法代码示例

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


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

示例1: frontier_post_set_cap

function frontier_post_set_cap()
{
    include FRONTIER_POST_DIR . "/include/frontier_post_defaults.php";
    $fps_saved_capabilities = frontier_post_get_capabilities();
    // Reinstate roles
    $fps_roles = new WP_Roles();
    $role_list = $fps_roles->get_names();
    foreach ($role_list as $key => $item) {
        $xrole = get_role($key);
        $tmp_caplist = $fps_saved_capabilities[$key];
        foreach ($tmp_caplist as $tmp_cap => $tmp_value) {
            $fps_cap_name = $tmp_cap;
            // Check that the name is a capability (not editor or category)
            if (array_key_exists($fps_cap_name, $fp_capability_list) == true) {
                if ($tmp_value == "true") {
                    $xrole->add_cap($tmp_cap);
                } else {
                    $xrole->remove_cap($tmp_cap);
                }
                $xrole->remove_cap('frontier_post_' . $tmp_cap);
            } else {
            }
        }
        // end tmp_caplist
    }
    // end role_list
}
开发者ID:otkinsey,项目名称:wp-nsds,代码行数:27,代码来源:frontier-post-admin-util.php

示例2: get_all_wp_roles

 public static function get_all_wp_roles()
 {
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     return $wp_roles->get_names();
 }
开发者ID:hamednourhani,项目名称:baharloo-appoitment,代码行数:8,代码来源:class_app_roles.php

示例3: wp_roles

 public function wp_roles()
 {
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $return = $wp_roles->get_names();
     return $return;
 }
开发者ID:RCMmedia,项目名称:rubicon,代码行数:9,代码来源:wordpress_user.php

示例4: cab_get_roles

function cab_get_roles()
{
    global $wp_roles;
    if (!isset($wp_roles)) {
        $wp_roles = new WP_Roles();
    }
    $roles = $wp_roles->get_names();
    return $roles;
}
开发者ID:tkxhoa,项目名称:movie,代码行数:9,代码来源:custom-admin-bar-functions.php

示例5: bd_pseudo_role_field_get_available_roles

/**
 * 
 * @global WP_Roles $wp_roles
 * @return type
 */
function bd_pseudo_role_field_get_available_roles()
{
    global $wp_roles;
    if (empty($wp_roles)) {
        $wp_roles = new WP_Roles();
    }
    $all_roles = $wp_roles->get_names();
    //all roles as role=>role_name
    return apply_filters('bp_pseudo_role_field_roles', $all_roles);
}
开发者ID:buddydev,项目名称:bp-pseudo-role-field,代码行数:15,代码来源:bp-pseudo-role-field-functions.php

示例6:

 function get_role_names()
 {
     global $wp_roles;
     if (!isset($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $roles = $wp_roles->get_names();
     $roles['guest'] = 'Guest';
     return $roles;
 }
开发者ID:dss-web,项目名称:erklaringmothatytringer-wp-advance-comment,代码行数:10,代码来源:settings.php

示例7: woocommerce_add_filter_hide_product

 public static function woocommerce_add_filter_hide_product($settings)
 {
     $args = array('post_type' => 'product', 'posts_per_page' => '-1');
     $checkproducts = get_posts($args);
     if (is_array($checkproducts)) {
         foreach ($checkproducts as $product) {
             $product_id[] = $product->ID;
             $product_title[] = get_the_title($product->ID);
         }
     }
     if (is_array($checkproducts)) {
         $newcombinedvalues = array_combine((array) $product_id, (array) $product_title);
     }
     $get_terms_product = get_terms('product_cat', array('hide_empty' => 'false'));
     //var_dump($get_terms_product);
     $current_category_products = array();
     if (!empty($get_terms_product) && is_array($get_terms_product)) {
         foreach ($get_terms_product as $each_term) {
             $current_category_products[$each_term->term_id] = $each_term->name;
         }
     }
     //var_dump($current_category_products);
     $updated_settings = array();
     $mainvariable = array();
     foreach ($settings as $section) {
         if (isset($section['id']) && '_woo_hide_products_maincontent' == $section['id'] && isset($section['type']) && 'sectionend' == $section['type']) {
             global $wp_roles;
             if (!isset($wp_roles)) {
                 $wp_roles = new WP_Roles();
             }
             $getdata = $wp_roles->get_names();
             foreach ($getdata as $data => $key) {
                 $updated_settings[] = array('name' => __('Toggle Shop Products for ' . $key, 'woohideproducts'), 'type' => 'title', 'id' => '_woo_hide_products_' . $data);
                 $updated_settings[] = array('name' => __('Toggle Type', 'woohideproducts'), 'desc' => __('Toggle Products by category or certain products', 'woohideproducts'), 'tip' => '', 'id' => 'woo_toggle_products_by_type_' . $data, 'css' => '', 'std' => '1', 'defaultvalue' => 'woo_toggle_products_by_type_' . $data, 'type' => 'select', 'options' => array('1' => __('By Products', 'woohideproducts'), '2' => __('By Categories', 'woohideproducts')), 'desc_tip' => true);
                 $updated_settings[] = array('name' => __('Hide Products in Category', 'woohideproducts'), 'desc' => __('Hide Products in Category Page of WooCommerce', 'woohideproducts'), 'tip' => '', 'id' => 'woo_hide_products_in_category_' . $data, 'css' => '', 'std' => 'yes', 'defaultvalue' => 'woo_hide_products_in_category_' . $data, 'type' => 'checkbox', 'desc_tip' => '');
                 $updated_settings[] = array('name' => __('Hide Products in Search Result', 'woohideproducts'), 'desc' => __('Hide Products in Search Result of WooCommerce', 'woohideproducts'), 'tip' => '', 'id' => 'woo_hide_products_in_search_' . $data, 'css' => '', 'std' => 'yes', 'defaultvalue' => 'woo_hide_products_in_search_' . $data, 'type' => 'checkbox', 'desc_tip' => '');
                 $updated_settings[] = array('name' => __('Toggle Include/Exclude Archive Products', 'woohideproducts'), 'desc' => __('Toggle Include Products/Exclude Products in WooCommerce Shop Page', 'woohideproducts'), 'tip' => '', 'id' => 'woo_include_exclude_products_' . $data, 'css' => '', 'std' => '2', 'defaultvalue' => 'woo_include_exclude_products_' . $data, 'type' => 'radio', 'options' => array('1' => __('Include', 'woohideproducts'), '2' => __('Exclude', 'woohideproducts')), 'desc_tip' => true);
                 $updated_settings[] = array('name' => __('Choose Category', 'woohideproducts'), 'desc' => __('Want to hide products in a bulk way then using this option to hide the products', 'woohideproducts'), 'tip' => '', 'id' => 'woo_toggle_type_category_' . $data, 'css' => '', 'std' => '', 'defaultvalue' => 'woo_toggle_type_category_' . $data, 'type' => 'multiselect', 'options' => $current_category_products);
                 $updated_settings[] = array('name' => __('Select Product to Toggle Shop', 'woohideproducts'), 'desc' => __('Select Product which will be Toggle Shop in Shop Page', 'woohideproducts'), 'tip' => '', 'id' => 'woo_select_products_' . $data, 'css' => '', 'std' => '', 'type' => 'multiselect', 'options' => $newcombinedvalues);
                 $updated_settings[] = array('type' => 'sectionend', 'id' => '_woo_hide_products_' . $data);
             }
             $updated_settings[] = array('name' => __('Toggle Shop Products for Guest', 'woohideproducts'), 'type' => 'title', 'id' => '_woo_hide_products_guest');
             $updated_settings[] = array('name' => __('Toggle Type', 'woohideproducts'), 'desc' => __('Toggle Products by category or certain products', 'woohideproducts'), 'tip' => '', 'id' => 'woo_toggle_products_by_type_guest', 'css' => '', 'std' => '1', 'defaultvalue' => 'woo_toggle_products_by_type_guest', 'type' => 'select', 'options' => array('1' => __('By Products', 'woohideproducts'), '2' => __('By Categories', 'woohideproducts')), 'desc_tip' => true);
             $updated_settings[] = array('name' => __('Hide Products in Category', 'woohideproducts'), 'desc' => __('Hide Products in Category Page of WooCommerce', 'woohideproducts'), 'tip' => '', 'id' => 'woo_hide_products_in_category_guest', 'css' => '', 'std' => 'yes', 'defaultvalue' => 'woo_hide_products_in_category_guest', 'type' => 'checkbox', 'desc_tip' => '');
             $updated_settings[] = array('name' => __('Hide Products in Search Result', 'woohideproducts'), 'desc' => __('Hide Products in Search Result of WooCommerce', 'woohideproducts'), 'tip' => '', 'id' => 'woo_hide_products_in_search_guest', 'css' => '', 'std' => 'yes', 'defaultvalue' => 'woo_hide_products_in_search_guest', 'type' => 'checkbox', 'desc_tip' => '');
             $updated_settings[] = array('name' => __('Toggle Include/Exclude Archive Products', 'woohideproducts'), 'desc' => __('Toggle Include Products/Exclude Products in WooCommerce Shop Page', 'woohideproducts'), 'tip' => '', 'id' => 'woo_include_exclude_products_guest', 'css' => '', 'std' => '2', 'defaultvalue' => 'woo_include_exclude_products_guest', 'type' => 'radio', 'options' => array('1' => __('Include', 'woohideproducts'), '2' => __('Exclude', 'woohideproducts')), 'desc_tip' => true);
             $updated_settings[] = array('name' => __('Choose Category', 'woohideproducts'), 'desc' => __('Want to hide products in a bulk way then using this option to hide the products', 'woohideproducts'), 'tip' => '', 'id' => 'woo_toggle_type_category_guest', 'css' => '', 'std' => '', 'defaultvalue' => 'woo_toggle_type_category_guest', 'type' => 'multiselect', 'options' => $current_category_products);
             $updated_settings[] = array('name' => __('Select Product to Toggle Shop', 'woohideproducts'), 'desc' => __('Select Product which will be Toggle Shop in Shop Page', 'woohideproducts'), 'tip' => '', 'id' => 'woo_select_products_guest', 'css' => '', 'std' => '', 'type' => 'multiselect', 'options' => $newcombinedvalues);
             $updated_settings[] = array('type' => 'sectionend', 'id' => '_woo_hide_products_guest');
         }
         $updated_settings[] = $section;
     }
     return $updated_settings;
 }
开发者ID:Qualitair,项目名称:ecommerce,代码行数:54,代码来源:class-admin-settings.php

示例8: array

 /**
  * Returns all the settings fields
  *
  * @return array settings fields
  */
 static function get_settings_fields()
 {
     global $wp_roles;
     $settings_fields = array();
     if (!$wp_roles) {
         $wp_roles = new WP_Roles();
     }
     $role_names = $wp_roles->get_names();
     $settings_fields['cpm_general'] = apply_filters('cpm_settings_field_general', array(array('name' => 'upload_limit', 'label' => __('File Upload Limit', 'cpm'), 'default' => '2', 'desc' => __('file size in Megabyte. e.g: 2')), array('name' => 'pagination', 'label' => __('Number of project per page', 'cpm'), 'type' => 'text', 'default' => '10', 'desc' => __('-1 for unlimited', 'cpm')), array('name' => 'project_manage_role', 'label' => __('Project Manage Capability', 'cpm'), 'default' => array('editor' => 'editor', 'author' => 'author', 'administrator' => 'administrator'), 'desc' => __('Select the user role who can see and manage all projects', 'cpm'), 'type' => 'multicheck', 'options' => $role_names), array('name' => 'project_create_role', 'label' => __('Project Create Capability', 'cpm'), 'default' => array('editor' => 'editor', 'author' => 'author', 'administrator' => 'administrator'), 'desc' => __('Select the user role who can create projects', 'cpm'), 'type' => 'multicheck', 'options' => $role_names)));
     $settings_fields['cpm_mails'] = apply_filters('cpm_settings_field_mail', array(array('name' => 'email_from', 'label' => __('From Email', 'cpm'), 'type' => 'text', 'desc' => '', 'default' => get_option('admin_email')), array('name' => 'email_type', 'label' => __('E-Mail Type', 'cpm'), 'type' => 'select', 'default' => 'text/plain', 'options' => array('text/html' => __('HTML Mail', 'cpm'), 'text/plain' => __('Plain Text', 'cpm'))), array('name' => 'email_bcc_enable', 'label' => __('Send email via Bcc', 'cpm'), 'type' => 'checkbox', 'default' => 'off', 'desc' => __('Enable Bcc'))));
     return apply_filters('cpm_settings_fields', $settings_fields);
 }
开发者ID:sayfulit,项目名称:wp-project-manager,代码行数:17,代码来源:admin.php

示例9: default_options

 /**
  * Returns default options
  *
  * @since 6.3
  * @access public
  *
  * @return array Default options
  */
 public static function default_options()
 {
     global $wp_roles;
     if (empty($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $options = array();
     foreach ($wp_roles->get_names() as $role => $label) {
         if ('pending' != $role) {
             $options[$role] = array('login_type' => 'default', 'login_url' => '', 'logout_type' => 'default', 'logout_url' => '');
         }
     }
     return $options;
 }
开发者ID:jsdesarrolloweb,项目名称:Plugin-Theme-My-Login-Spanish,代码行数:22,代码来源:custom-redirection.php

示例10: default_options

 /**
  * Returns default options
  *
  * @since 6.3
  * @access public
  *
  * @return array Default options
  */
 public static function default_options()
 {
     global $wp_roles;
     if (empty($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $options = array();
     foreach ($wp_roles->get_names() as $role => $label) {
         if ('pending' != $role) {
             $options[$role] = array('theme_profile' => true, 'restrict_admin' => false);
         }
     }
     return $options;
 }
开发者ID:dot2006,项目名称:jobify,代码行数:22,代码来源:themed-profiles.php

示例11: install_capabilities

 public function install_capabilities()
 {
     $roles = $GLOBALS['wp_roles']->roles;
     global $wp_roles;
     if (!isset($roles)) {
         $wp_roles = new WP_Roles();
         $roles = $wp_roles->get_names();
     }
     if (is_array($roles)) {
         foreach ($roles as $key => $value) {
             $this->add_role_capabilities($key);
         }
     }
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:14,代码来源:capabilities.php

示例12: default_options

 /**
  * Returns default options
  *
  * @since 6.3
  * @access public
  *
  * @return array Default options
  */
 public static function default_options()
 {
     global $wp_roles;
     if (empty($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $options = array();
     foreach ($wp_roles->get_names() as $role => $role_name) {
         if ('pending' != $role) {
             $options[$role] = array(array('title' => __('Dashboard', 'theme-my-login'), 'url' => admin_url()), array('title' => __('Profile', 'theme-my-login'), 'url' => admin_url('profile.php')));
         }
     }
     return $options;
 }
开发者ID:tkxhoa,项目名称:movie,代码行数:22,代码来源:custom-user-links.php

示例13: add_caps

 public function add_caps()
 {
     if ($this->users_settings) {
         return;
     }
     global $wp_roles;
     if (!isset($wp_roles) || !is_object($wp_roles)) {
         $wp_roles = new WP_Roles();
     }
     $wpcf_capabilities = array_keys(self::wpcf_get_capabilities());
     $roles = $wp_roles->get_names();
     foreach ($roles as $current_role => $role_name) {
         $capability_can = apply_filters('wpcf_capability_can', 'manage_options');
         if (isset($wp_roles->roles[$current_role]['capabilities'][$capability_can])) {
             $role = get_role($current_role);
             if (isset($role) && is_object($role)) {
                 for ($i = 0, $caps_limit = count($wpcf_capabilities); $i < $caps_limit; $i++) {
                     if (!isset($wp_roles->roles[$current_role]['capabilities'][$wpcf_capabilities[$i]])) {
                         $role->add_cap($wpcf_capabilities[$i]);
                     }
                 }
             }
         }
     }
     //Set new caps for all Super Admins
     $super_admins = get_super_admins();
     foreach ($super_admins as $admin) {
         $updated_current_user = new WP_User($admin);
         for ($i = 0, $caps_limit = count($wpcf_capabilities); $i < $caps_limit; $i++) {
             $updated_current_user->add_cap($wpcf_capabilities[$i]);
         }
     }
     // We need to refresh $current_user caps to display the entire NNN menu
     // If $current_user has not been updated yet with the new capabilities,
     global $current_user;
     if (isset($current_user) && isset($current_user->ID)) {
         // Insert the capabilities for the current execution
         $updated_current_user = new WP_User($current_user->ID);
         for ($i = 0, $caps_limit = count($wpcf_capabilities); $i < $caps_limit; $i++) {
             if ($updated_current_user->has_cap($wpcf_capabilities[$i])) {
                 $current_user->add_cap($wpcf_capabilities[$i]);
             }
         }
         // Refresh $current_user->allcaps
         $current_user->get_role_caps();
     }
     $this->users_settings = true;
     update_option(self::$users_settings_name, $this->users_settings);
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:49,代码来源:class.wpcf.roles.php

示例14: rbhn_capabilities_clean_up

function rbhn_capabilities_clean_up( ) {

    global $wp_roles;
 
    if ( ! isset( $wp_roles ) )
        $wp_roles = new WP_Roles( );
            
    $roles = $wp_roles->get_names( );

    // loop through the roles to create the capability list that needs to be cleaned out
	foreach( $roles as $role_key=>$role_name ) 
    {
        rbhn_role_caps_uninstall( $role_key );
    }
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:15,代码来源:uninstall.php

示例15: foreach

 function set_permissions()
 {
     $wp_roles = new WP_Roles();
     $all_roles = $wp_roles->get_names();
     foreach ($all_roles as $role => $name) {
         $role_object = get_role($role);
         foreach ($this->permissions as $cap => $grant) {
             if ($cap == 'publish_wiki_pages' && $role == 'wiki_editor') {
                 continue;
             } else {
                 $role_object->add_cap($cap);
             }
         }
     }
 }
开发者ID:radgeek,项目名称:WikiWikiWordPress,代码行数:15,代码来源:wiki_post_type.php


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