当前位置: 首页>>代码示例>>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;未经允许,请勿转载。