当前位置: 首页>>代码示例>>PHP>>正文


PHP BP_Groups_Group::get_random方法代码示例

本文整理汇总了PHP中BP_Groups_Group::get_random方法的典型用法代码示例。如果您正苦于以下问题:PHP BP_Groups_Group::get_random方法的具体用法?PHP BP_Groups_Group::get_random怎么用?PHP BP_Groups_Group::get_random使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BP_Groups_Group的用法示例。


在下文中一共展示了BP_Groups_Group::get_random方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_get_random_with_search_terms

 public function test_get_random_with_search_terms()
 {
     $g1 = $this->factory->group->create(array('name' => 'Bodacious'));
     $g2 = $this->factory->group->create(array('name' => 'Crummy group'));
     // Only one group will match, so the random part doesn't matter
     $groups = BP_Groups_Group::get_random(null, null, 0, 'daci');
     $found = wp_list_pluck($groups['groups'], 'id');
     $this->assertEquals(array($g1), $found);
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:9,代码来源:class-bp-groups-group.php

示例2: groups_action_redirect_to_random_group

/**
 * Catch requests for a random group page (example.com/groups/?random-group) and redirect.
 */
function groups_action_redirect_to_random_group()
{
    if (bp_is_groups_component() && isset($_GET['random-group'])) {
        $group = BP_Groups_Group::get_random(1, 1);
        bp_core_redirect(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group['groups'][0]->slug . '/');
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:10,代码来源:bp-groups-actions.php

示例3: groups_action_redirect_to_random_group

/**
 * Catch requests for a random group page (example.com/groups/?random-group) and redirect.
 */
function groups_action_redirect_to_random_group()
{
    if (bp_is_groups_component() && isset($_GET['random-group'])) {
        $group = BP_Groups_Group::get_random(1, 1);
        bp_core_redirect(trailingslashit(bp_get_groups_directory_permalink() . $group['groups'][0]->slug));
    }
}
开发者ID:jasonmcalpin,项目名称:BuddyPress,代码行数:10,代码来源:bp-groups-actions.php

示例4: groups_get_groups

function groups_get_groups( $args = '' ) {
	global $bp;

	$defaults = array(
		'type' => 'active', // active, newest, alphabetical, random, popular, most-forum-topics or most-forum-posts
		'user_id' => false, // Pass a user_id to limit to only groups that this user is a member of
		'search_terms' => false, // Limit to groups that match these search terms

		'per_page' => 20, // The number of results to return per page
		'page' => 1, // The page to return if limiting per page
		'populate_extras' => true, // Fetch meta such as is_banned and is_member
	);

	$params = wp_parse_args( $args, $defaults );
	extract( $params, EXTR_SKIP );

	switch ( $type ) {
		case 'active': default:
			$groups = BP_Groups_Group::get_active( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
		case 'newest':
			$groups = BP_Groups_Group::get_newest( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
		case 'popular':
			$groups = BP_Groups_Group::get_popular( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
		case 'alphabetical':
			$groups = BP_Groups_Group::get_alphabetically( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
		case 'random':
			$groups = BP_Groups_Group::get_random( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
		case 'most-forum-topics':
			$groups = BP_Groups_Group::get_by_most_forum_topics( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
		case 'most-forum-posts':
			$groups = BP_Groups_Group::get_by_most_forum_posts( $per_page, $page, $user_id, $search_terms, $populate_extras );
			break;
	}

	return apply_filters( 'groups_get_groups', $groups, &$params );
}
开发者ID:n-sane,项目名称:zaroka,代码行数:42,代码来源:bp-groups.php

示例5: groups_get_random_group

function groups_get_random_group()
{
    return BP_Groups_Group::get_random();
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:4,代码来源:bp-groups.php

示例6: 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));
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:45,代码来源:bp-groups-templatetags.php


注:本文中的BP_Groups_Group::get_random方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。