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


PHP BP_Core_User::get_users_by_letter方法代码示例

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


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

示例1: test_get_users_by_letter

 /**
  * @group get_users_by_letter
  */
 public function test_get_users_by_letter()
 {
     $u1 = $this->factory->user->create(array('display_name' => 'foo'));
     $u2 = $this->factory->user->create(array('display_name' => 'bar'));
     $q = BP_Core_User::get_users_by_letter('b');
     $found = array_map('intval', wp_list_pluck($q['users'], 'id'));
     $this->assertEquals(array($u2), $found);
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:11,代码来源:class-bp-core-user.php

示例2: bp_core_members_template

	function bp_core_members_template( $type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras ) {
		global $bp;

		$this->pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number;
		$this->pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $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 );
		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 ) );

		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' => '←',
				'next_text' => '→',
				'mid_size'  => 1
			) );
		}
	}
开发者ID:n-sane,项目名称:zaroka,代码行数:41,代码来源:bp-core-templatetags.php

示例3: bp_core_members_template

 function bp_core_members_template($type, $per_page, $max)
 {
     global $bp, $bp_the_member_query;
     $this->pag_page = isset($_REQUEST['upage']) ? intval($_REQUEST['upage']) : 1;
     $this->pag_num = isset($_REQUEST['num']) ? intval($_REQUEST['num']) : $per_page;
     if (isset($_REQUEST['s']) && '' != $_REQUEST['s'] && $type != 'random') {
         $this->members = BP_Core_User::search_users($_REQUEST['s'], $this->pag_num, $this->pag_page);
     } else {
         if (isset($_REQUEST['letter']) && '' != $_REQUEST['letter']) {
             $this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page);
         } else {
             switch ($type) {
                 case 'random':
                     $this->members = BP_Core_User::get_random_users($this->pag_num, $this->pag_page);
                     break;
                 case 'newest':
                     $this->members = BP_Core_User::get_newest_users($this->pag_num, $this->pag_page);
                     break;
                 case 'popular':
                     $this->members = BP_Core_User::get_popular_users($this->pag_num, $this->pag_page);
                     break;
                 case 'online':
                     $this->members = BP_Core_User::get_online_users($this->pag_num, $this->pag_page);
                     break;
                 case 'alphabetical':
                     $this->members = BP_Core_User::get_alphabetical_users($this->pag_num, $this->pag_page);
                     break;
                 case 'active':
                 default:
                     $this->members = BP_Core_User::get_active_users($this->pag_num, $this->pag_page);
                     break;
             }
         }
     }
     if (!$max) {
         $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);
     }
     $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' => '«', 'next_text' => '»', 'mid_size' => 1));
 }
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:51,代码来源:bp-core-templatetags.php

示例4: __construct

 /**
  * Constructor method.
  *
  * @see BP_User_Query for an in-depth description of parameters.
  *
  * @param string       $type                Sort order.
  * @param int          $page_number         Page of results.
  * @param int          $per_page            Number of results per page.
  * @param int          $max                 Max number of results to return.
  * @param int          $user_id             Limit to friends of a user.
  * @param string       $search_terms        Limit to users matching search terms.
  * @param array        $include             Limit results by these user IDs.
  * @param bool         $populate_extras     Fetch optional extras.
  * @param array        $exclude             Exclude these IDs from results.
  * @param array        $meta_key            Limit to users with a meta_key.
  * @param array        $meta_value          Limit to users with a meta_value (with meta_key).
  * @param string       $page_arg            Optional. The string used as a query parameter in pagination links.
  *                                          Default: 'upage'.
  * @param array|string $member_type         Array or comma-separated string of member types to limit results to.
  * @param array|string $member_type__in     Array or comma-separated string of member types to limit results to.
  * @param array|string $member_type__not_in Array or comma-separated string of member types to exclude
  *                                          from results.
  */
 function __construct($type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage', $member_type = '', $member_type__in = '', $member_type__not_in = '')
 {
     $this->pag_arg = sanitize_key($page_arg);
     $this->pag_page = bp_sanitize_pagination_arg($this->pag_arg, $page_number);
     $this->pag_num = bp_sanitize_pagination_arg('num', $per_page);
     $this->type = $type;
     if (!empty($_REQUEST['letter'])) {
         $this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras, $exclude);
     } 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, 'member_type' => $member_type, 'member_type__in' => $member_type__in, 'member_type__not_in' => $member_type__not_in));
     }
     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) {
         $pag_args = array($this->pag_arg => '%#%');
         if (defined('DOING_AJAX') && true === (bool) DOING_AJAX) {
             $base = remove_query_arg('s', wp_get_referer());
         } else {
             $base = '';
         }
         /**
          * Defaults to an empty array to make sure paginate_links()
          * won't add the $page_arg to the links which would break
          * pagination in case JavaScript is disabled.
          */
         $add_args = array();
         if (!empty($search_terms)) {
             $query_arg = bp_core_get_component_search_query_arg('members');
             $add_args[$query_arg] = urlencode($search_terms);
         }
         $this->pag_links = paginate_links(array('base' => add_query_arg($pag_args, $base), '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, 'add_args' => $add_args));
     }
 }
开发者ID:mawilliamson,项目名称:wordpress,代码行数:69,代码来源:bp-members-template.php

示例5: __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));
     }
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:34,代码来源:bp-members-template.php

示例6: __construct

 /**
  * Constructor method.
  *
  * @see BP_User_Query for an in-depth description of parameters.
  *
  * @param string $type Sort order.
  * @param int $page_number Page of results.
  * @param int $per_page Number of results per page.
  * @param int $max Max number of results to return.
  * @param int $user_id Limit to friends of a user.
  * @param string $search_terms Limit to users matching search terms.
  * @param array $include Limit results by these user IDs.
  * @param bool $populate_extras Fetch optional extras.
  * @param array $exclude Exclude these IDs from results.
  * @param array $meta_key Limit to users with a meta_key.
  * @param array $meta_value Limit to users with a meta_value (with meta_key).
  * @param array $page_arg Optional. The string used as a query
  *        parameter in pagination links. Default: 'upage'.
  */
 function __construct($type, $page_number, $per_page, $max, $user_id, $search_terms, $include, $populate_extras, $exclude, $meta_key, $meta_value, $page_arg = 'upage')
 {
     $this->pag_page = !empty($_REQUEST[$page_arg]) ? intval($_REQUEST[$page_arg]) : (int) $page_number;
     $this->pag_num = !empty($_REQUEST['num']) ? intval($_REQUEST['num']) : (int) $per_page;
     $this->type = $type;
     if (!empty($_REQUEST['letter'])) {
         $this->members = BP_Core_User::get_users_by_letter($_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras, $exclude);
     } 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) {
         $pag_args = array($page_arg => '%#%');
         if (defined('DOING_AJAX') && true === (bool) DOING_AJAX) {
             $base = remove_query_arg('s', wp_get_referer());
         } else {
             $base = '';
         }
         if (!empty($search_terms)) {
             $pag_args['s'] = $search_terms;
         }
         $this->pag_links = paginate_links(array('base' => add_query_arg($pag_args, $base), '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));
     }
 }
开发者ID:eresyyl,项目名称:mk,代码行数:57,代码来源:bp-members-template.php


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