本文整理汇总了PHP中BP_Groups_Group::search_groups方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Group::search_groups方法的具体用法?PHP BP_Groups_Group::search_groups怎么用?PHP BP_Groups_Group::search_groups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BP_Groups_Group
的用法示例。
在下文中一共展示了BP_Groups_Group::search_groups方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_search_groups_search_with_quotes
public function test_search_groups_search_with_quotes()
{
$g1 = $this->factory->group->create(array('name' => 'Cool Group', 'description' => "'tis sweet"));
$g2 = $this->factory->group->create();
$groups = BP_Groups_Group::search_groups("'tis ");
$found = wp_list_pluck($groups['groups'], 'group_id');
$this->assertEquals(array($g1), $found);
}
示例2: bp_groups_site_groups_template
function bp_groups_site_groups_template($type, $per_page, $max)
{
global $bp;
$this->pag_page = isset($_REQUEST['gpage']) ? intval($_REQUEST['gpage']) : 1;
$this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
if (isset($_REQUEST['s']) && '' != $_REQUEST['s'] && $type != 'random') {
$this->groups = BP_Groups_Group::search_groups($_REQUEST['s'], $this->pag_num, $this->pag_page);
} else {
if (isset($_REQUEST['letter']) && '' != $_REQUEST['letter']) {
$this->groups = BP_Groups_Group::get_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page);
} else {
switch ($type) {
case 'random':
$this->groups = BP_Groups_Group::get_random($this->pag_num, $this->pag_page);
break;
case 'newest':
$this->groups = BP_Groups_Group::get_newest($this->pag_num, $this->pag_page);
break;
case 'popular':
$this->groups = BP_Groups_Group::get_popular($this->pag_num, $this->pag_page);
break;
case 'active':
default:
$this->groups = BP_Groups_Group::get_active($this->pag_num, $this->pag_page);
break;
}
}
}
if (!$max) {
$this->total_group_count = (int) $this->groups['total'];
} else {
$this->total_group_count = (int) $max;
}
$this->groups = $this->groups['groups'];
if ($max) {
if ($max >= count($this->groups)) {
$this->group_count = count($this->groups);
} else {
$this->group_count = (int) $max;
}
} else {
$this->group_count = count($this->groups);
}
$this->pag_links = paginate_links(array('base' => add_query_arg('gpage', '%#%'), 'format' => '', 'total' => ceil((int) $this->total_group_count / (int) $this->pag_num), 'current' => (int) $this->pag_page, 'prev_text' => '«', 'next_text' => '»', 'mid_size' => 1));
}
示例3: groups_search_groups
function groups_search_groups($search_terms, $pag_num_per_page = 5, $pag_page = 1, $sort_by = false, $order = false)
{
return BP_Groups_Group::search_groups($search_terms, $pag_num_per_page, $pag_page, $sort_by, $order);
}
示例4: humcore_get_id_from_name
/**
* Returns group id for a given group name.
*
* @return string
*/
function humcore_get_id_from_name($group_name)
{
// Check cache for group slug.
$group_id = wp_cache_get($group_name, 'humcore_get_id_from_name');
if (false === $group_id) {
$group = BP_Groups_Group::search_groups($group_name, 1);
$group_id = $group['groups'][0]->group_id;
wp_cache_set($group_name, $group_id, 'humcore_get_id_from_name');
}
return $group_id;
}