本文整理汇总了PHP中BP_Core_User::get_specific_users方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Core_User::get_specific_users方法的具体用法?PHP BP_Core_User::get_specific_users怎么用?PHP BP_Core_User::get_specific_users使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Core_User
的用法示例。
在下文中一共展示了BP_Core_User::get_specific_users方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value)
{
global $bp;
$this->pag_page = !empty($_REQUEST['upage']) ? intval($_REQUEST['upage']) : (int) $page_number;
$this->pag_num = !empty($_REQUEST['num']) ? intval($_REQUEST['num']) : (int) $per_page;
$this->type = $type;
if (isset($_REQUEST['letter']) && '' != $_REQUEST['letter']) {
$this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras, $exclude);
} else {
if (false !== $include) {
$this->members = BP_Core_User::get_specific_users($include, $this->pag_num, $this->pag_page, $populate_extras);
} else {
$this->members = bp_core_get_users(array('type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'include' => $include, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras, 'exclude' => $exclude, 'meta_key' => $meta_key, 'meta_value' => $meta_value));
}
}
if (!$max || $max >= (int) $this->members['total']) {
$this->total_member_count = (int) $this->members['total'];
} else {
$this->total_member_count = (int) $max;
}
$this->members = $this->members['users'];
if ($max) {
if ($max >= count($this->members)) {
$this->member_count = count($this->members);
} else {
$this->member_count = (int) $max;
}
} else {
$this->member_count = count($this->members);
}
if ((int) $this->total_member_count && (int) $this->pag_num) {
$this->pag_links = paginate_links(array('base' => add_query_arg('upage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_member_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => _x('←', 'Member pagination previous text', 'buddypress'), 'next_text' => _x('→', 'Member pagination next text', 'buddypress'), 'mid_size' => 1));
}
}
示例2: test_get_specific_users
public function test_get_specific_users()
{
$u1 = $this->factory->user->create();
$u2 = $this->factory->user->create();
$u3 = $this->factory->user->create();
$include_array = array($u1, 'junkstring', $u3);
$users = BP_Core_User::get_specific_users($include_array);
$user_ids = wp_parse_id_list(wp_list_pluck($users['users'], 'id'));
$this->assertEquals(array($u1, $u3), $user_ids);
}