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


PHP WP_User_Query::get方法代碼示例

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


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

示例1: formatResults

 /**
  * 
  * @param \WP_User_Query $uQuery
  * @return multitype:number multitype:multitype:string Ambigous <false, string>
  */
 public function formatResults(\WP_User_Query $uQuery)
 {
     $userArray = array();
     foreach ($uQuery->get_results() as $user) {
         $userArray[] = $this->formatUserAsArray($user);
     }
     return array("page" => $this->getPage($uQuery->get("number"), $uQuery->get("offset")), "pages" => $this->getNumberOfPages($uQuery->total_users, $uQuery->get("number")), "limit" => $uQuery->get("number"), "total" => $uQuery->total_users, "users" => $userArray);
 }
開發者ID:javierdlahoz,項目名稱:dcbia-wp,代碼行數:13,代碼來源:MemberFacade.php

示例2:

 function test_get_and_set()
 {
     $users = new WP_User_Query();
     $this->assertEquals('', $users->get('fields'));
     $this->assertEquals('', @$users->query_vars['fields']);
     $users->set('fields', 'all');
     $this->assertEquals('all', $users->get('fields'));
     $this->assertEquals('all', $users->query_vars['fields']);
     $users->set('fields', '');
     $this->assertEquals('', $users->get('fields'));
     $this->assertEquals('', $users->query_vars['fields']);
     $this->assertNull($users->get('does-not-exist'));
 }
開發者ID:atimmer,項目名稱:wordpress-develop-mirror,代碼行數:13,代碼來源:query.php

示例3: hocwp_setup_theme_pre_get_users

function hocwp_setup_theme_pre_get_users(WP_User_Query $query)
{
    if (is_admin()) {
        if ($GLOBALS['pagenow'] == 'users.php') {
            $user = wp_get_current_user();
            $exclude = (array) $query->get('exclude');
            $exclude[] = $user->ID;
            $exclude = array_unique($exclude);
            $query->set('exclude', $exclude);
        }
    }
    return $query;
}
開發者ID:skylarkcob,項目名稱:hocwp-projects,代碼行數:13,代碼來源:setup-theme-after.php


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