當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WPCF_Roles::getInstance方法代碼示例

本文整理匯總了PHP中WPCF_Roles::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP WPCF_Roles::getInstance方法的具體用法?PHP WPCF_Roles::getInstance怎麽用?PHP WPCF_Roles::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WPCF_Roles的用法示例。


在下文中一共展示了WPCF_Roles::getInstance方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: upgrade_db_to_2010000

 /**
  * Upgrade database to 2010000 (Types 2.1) 
  *
  * Batch fix types-768 for all non-superadmin users.
  */
 function upgrade_db_to_2010000()
 {
     $roles_manager = WPCF_Roles::getInstance();
     global $wpdb;
     // Will find users without the administrator roles but with one of the Types management roles.
     // A sign of the types-768 bug.
     $user_query = new WP_User_Query(array('meta_query' => array('relation' => 'AND', array('key' => $wpdb->prefix . 'capabilities', 'value' => '"administrator"', 'compare' => 'NOT LIKE'), array('key' => $wpdb->prefix . 'capabilities', 'value' => '"wpcf_custom_post_type_view"', 'compare' => 'LIKE'))));
     $users = $user_query->get_results();
     foreach ($users as $user) {
         $roles_manager->clean_the_mess_in_nonadmin_user_caps($user);
     }
 }
開發者ID:uwmadisoncals,項目名稱:Cluster-Plugins,代碼行數:17,代碼來源:upgrade.php

示例2: switch

<?php

/**
 *
 * Admin functions
 *
 *
 */
require_once WPCF_ABSPATH . '/marketing.php';
require_once WPCF_ABSPATH . '/includes/classes/class.wpcf.roles.php';
WPCF_Roles::getInstance();
/*
 * This needs to be called after main 'init' hook.
 * Main init hook calls required Types code for frontend.
 * Admin init hook only in admin area.
 *
 * TODO Revise it to change to 'admin_init'
 */
add_action('admin_init', 'wpcf_admin_init_hook', 11);
add_action('init', 'wpcf_init_admin_pages');
add_action('admin_menu', 'wpcf_admin_menu_hook');
add_action('wpcf_admin_page_init', 'wpcf_enqueue_scripts');
add_action('admin_enqueue_scripts', 'wpcf_admin_enqueue_scripts');
// OMG, why so early? At this point we don't even have embedded Types (with functions.php).
if (defined('DOING_AJAX')) {
    require_once WPCF_INC_ABSPATH . '/ajax.php';
    if (isset($_REQUEST['action'])) {
        switch ($_REQUEST['action']) {
            /**
             * post edit screen
             */
開發者ID:torch2424,項目名稱:Team-No-Comply-Games-Wordpress,代碼行數:31,代碼來源:admin.php


注:本文中的WPCF_Roles::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。