Skip to:
Content

BuddyPress.org

Changeset 9977


Ignore:
Timestamp:
06/29/2015 03:06:53 PM (10 years ago)
Author:
boonebgorges
Message:

Docblock formatting and codestyling after [9976].

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-user-query.php

    r9976 r9977  
    2020 * @param array $query {
    2121 *     Query arguments. All items are optional.
    22  *     @type string            $type            Determines sort order. Select from 'newest', 'active', 'online',
    23  *                                              'random', 'popular', 'alphabetical'. Default: 'newest'.
    24  *     @type int               $per_page Number of results to return. Default: 0 (no limit).
    25  *     @type int               $page            Page offset (together with $per_page). Default: 1.
    26  *     @type int               $user_id         ID of a user. If present, and if the friends component is activated,
    27  *                                              results will be limited to the friends of that user. Default: 0.
    28  *     @type string|bool       $search_terms    Terms to search by. Search happens across xprofile fields. Requires
    29  *                                              XProfile component. Default: false.
    30  *     @type string            $search_wildcard When searching with $search_terms, set where wildcards around the term
    31  *                                              should be positioned. Accepts 'both', 'left', 'right'. Default: 'both'.
    32  *     @type array|string|bool $include         An array or comma-separated list of user IDs to which query should
    33  *                                              be limited. Default: false.
    34  *     @type array|string|bool $exclude         An array or comma-separated list of user IDs that will be excluded from
    35  *                                              query results. Default: false.
    36  *     @type array|string|bool $user_ids        An array or comma-separated list of IDs corresponding to the users
    37  *                                              that should be returned. When this parameter is passed, it will
    38  *                                              override all others; BP User objects will be constructed using these
    39  *                                              IDs only. Default: false.
    40  *     @type array|string      $member_type     Array or comma-separated list of member types to limit results to.
    41  *     @type array|string      $member_type__in Array or comma-separated list of member types to limit results to.
     22 *     @type string            $type                Determines sort order. Select from 'newest', 'active', 'online',
     23 *                                                  'random', 'popular', 'alphabetical'. Default: 'newest'.
     24 *     @type int               $per_page            Number of results to return. Default: 0 (no limit).
     25 *     @type int               $page                Page offset (together with $per_page). Default: 1.
     26 *     @type int               $user_id             ID of a user. If present, and if the friends component is activated,
     27 *                                                  results will be limited to the friends of that user. Default: 0.
     28 *     @type string|bool       $search_terms        Terms to search by. Search happens across xprofile fields. Requires
     29 *                                                  XProfile component. Default: false.
     30 *     @type string            $search_wildcard     When searching with $search_terms, set where wildcards around the
     31 *                                                  term should be positioned. Accepts 'both', 'left', 'right'.
     32 *                                                  Default: 'both'.
     33 *     @type array|string|bool $include             An array or comma-separated list of user IDs to which query should
     34 *                                                  be limited. Default: false.
     35 *     @type array|string|bool $exclude             An array or comma-separated list of user IDs that will be excluded
     36 *                                                  from query results. Default: false.
     37 *     @type array|string|bool $user_ids            An array or comma-separated list of IDs corresponding to the users
     38 *                                                  that should be returned. When this parameter is passed, it will
     39 *                                                  override all others; BP User objects will be constructed using these
     40 *                                                  IDs only. Default: false.
     41 *     @type array|string      $member_type         Array or comma-separated list of member types to limit results to.
     42 *     @type array|string      $member_type__in     Array or comma-separated list of member types to limit results to.
    4243 *     @type array|string      $member_type__not_in Array or comma-separated list of member types that will be
    4344 *                                      excluded from results.
    44  *     @type string|bool       $meta_key        Limit results to users that have usermeta associated with this meta_key.
    45  *                                              Usually used with $meta_value. Default: false.
    46  *     @type string|bool       $meta_value      When used with $meta_key, limits results to users whose usermeta value
    47  *                                              associated with $meta_key matches $meta_value. Default: false.
    48  *     @type array             $xprofile_query  Filter results by xprofile data. Requires the xprofile component. See
    49  *                                              {@see BP_XProfile_Query} for details.
    50  *     @type bool              $populate_extras True if you want to fetch extra metadata
    51  *                                              about returned users, such as total group and friend counts.
    52  *     @type string            $count_total     Determines how BP_User_Query will do a count of total users matching
    53  *                                              the other filter criteria. Default value is 'count_query', which does
    54  *                                              a separate SELECT COUNT query to determine the total.
    55  *                                              'sql_count_found_rows' uses SQL_COUNT_FOUND_ROWS and
    56  *                                              SELECT FOUND_ROWS(). Pass an empty string to skip the total user
    57  *                                              count query.
     45 *     @type string|bool       $meta_key            Limit results to users that have usermeta associated with this meta_key.
     46 *                                                  Usually used with $meta_value. Default: false.
     47 *     @type string|bool       $meta_value          When used with $meta_key, limits results to users whose usermeta value
     48 *                                                  associated with $meta_key matches $meta_value. Default: false.
     49 *     @type array             $xprofile_query      Filter results by xprofile data. Requires the xprofile component.
     50 *                                                  See {@see BP_XProfile_Query} for details.
     51 *     @type bool              $populate_extras     True if you want to fetch extra metadata
     52 *                                                  about returned users, such as total group and friend counts.
     53 *     @type string            $count_total         Determines how BP_User_Query will do a count of total users matching
     54 *                                                  the other filter criteria. Default value is 'count_query', which
     55 *                                                  does a separate SELECT COUNT query to determine the total.
     56 *                                                  'sql_count_found_rows' uses SQL_COUNT_FOUND_ROWS and
     57 *                                                  SELECT FOUND_ROWS(). Pass an empty string to skip the total user
     58 *                                                  count query.
    5859 * }
    5960 */
     
    160161        if ( ! empty( $this->query_vars_raw ) ) {
    161162            $this->query_vars = wp_parse_args( $this->query_vars_raw, array(
    162                 'type'            => 'newest',
    163                 'per_page'        => 0,
    164                 'page'            => 1,
    165                 'user_id'         => 0,
    166                 'search_terms'    => false,
    167                 'search_wildcard' => 'both',
    168                 'include'         => false,
    169                 'exclude'         => false,
    170                 'user_ids'        => false,
    171                 'member_type'     => '',
    172                 'member_type__in' => '',
     163                'type'                => 'newest',
     164                'per_page'            => 0,
     165                'page'                => 1,
     166                'user_id'             => 0,
     167                'search_terms'        => false,
     168                'search_wildcard'     => 'both',
     169                'include'             => false,
     170                'exclude'             => false,
     171                'user_ids'            => false,
     172                'member_type'         => '',
     173                'member_type__in'     => '',
    173174                'member_type__not_in' => '',
    174                 'meta_key'        => false,
    175                 'meta_value'      => false,
    176                 'xprofile_query'  => false,
    177                 'populate_extras' => true,
    178                 'count_total'     => 'count_query'
     175                'meta_key'            => false,
     176                'meta_value'          => false,
     177                'xprofile_query'      => false,
     178                'populate_extras'     => true,
     179                'count_total'         => 'count_query'
    179180            ) );
    180181
  • trunk/src/bp-members/bp-members-functions.php

    r9976 r9977  
    7979 *     Array of arguments. All are optional. See {@link BP_User_Query} for
    8080 *     a more complete description of arguments.
    81  *     @type string       $type            Sort order. Default: 'active'.
    82  *     @type int          $user_id         Limit results to friends of a user. Default: false.
    83  *     @type mixed        $exclude         IDs to exclude from results. Default: false.
    84  *     @type string       $search_terms    Limit to users matching search terms. Default: false.
    85  *     @type string       $meta_key        Limit to users with a meta_key. Default: false.
    86  *     @type string       $meta_value      Limit to users with a meta_value (with meta_key). Default: false.
    87  *     @type array|string $member_type     Array or comma-separated string of member types.
    88  *     @type array|string $member_type__in Array or comma-separated string of member types.
    89  *                                         `$member_type` takes precedence over this parameter.
     81 *     @type string       $type                Sort order. Default: 'active'.
     82 *     @type int          $user_id             Limit results to friends of a user. Default: false.
     83 *     @type mixed        $exclude             IDs to exclude from results. Default: false.
     84 *     @type string       $search_terms        Limit to users matching search terms. Default: false.
     85 *     @type string       $meta_key            Limit to users with a meta_key. Default: false.
     86 *     @type string       $meta_value          Limit to users with a meta_value (with meta_key). Default: false.
     87 *     @type array|string $member_type         Array or comma-separated string of member types.
     88 *     @type array|string $member_type__in     Array or comma-separated string of member types.
     89 *                                             `$member_type` takes precedence over this parameter.
    9090 *     @type array|string $member_type__not_in Array or comma-separated string of member types to be excluded.
    91  *     @type mixed        $include         Limit results by user IDs. Default: false.
    92  *     @type int          $per_page        Results per page. Default: 20.
    93  *     @type int          $page            Page of results. Default: 1.
    94  *     @type bool         $populate_extras Fetch optional extras. Default: true.
    95  *     @type string|bool  $count_total     How to do total user count. Default: 'count_query'.
     91 *     @type mixed        $include             Limit results by user IDs. Default: false.
     92 *     @type int          $per_page            Results per page. Default: 20.
     93 *     @type int          $page                Page of results. Default: 1.
     94 *     @type bool         $populate_extras     Fetch optional extras. Default: true.
     95 *     @type string|bool  $count_total         How to do total user count. Default: 'count_query'.
    9696 * }
    9797 * @return array
     
    101101    // Parse the user query arguments
    102102    $r = bp_parse_args( $args, array(
    103         'type'            => 'active',     // active, newest, alphabetical, random or popular
    104         'user_id'         => false,        // Pass a user_id to limit to only friend connections for this user
    105         'exclude'         => false,        // Users to exclude from results
    106         'search_terms'    => false,        // Limit to users that match these search terms
    107         'meta_key'        => false,        // Limit to users who have this piece of usermeta
    108         'meta_value'      => false,        // With meta_key, limit to users where usermeta matches this value
    109         'member_type'     => '',
    110         'member_type__in' => '',
     103        'type'                => 'active',     // active, newest, alphabetical, random or popular
     104        'user_id'             => false,        // Pass a user_id to limit to only friend connections for this user
     105        'exclude'             => false,        // Users to exclude from results
     106        'search_terms'        => false,        // Limit to users that match these search terms
     107        'meta_key'            => false,        // Limit to users who have this piece of usermeta
     108        'meta_value'          => false,        // With meta_key, limit to users where usermeta matches this value
     109        'member_type'         => '',
     110        'member_type__in'     => '',
    111111        'member_type__not_in' => '',
    112         'include'         => false,        // Pass comma separated list of user_ids to limit to only these users
    113         'per_page'        => 20,           // The number of results to return per page
    114         'page'            => 1,            // The page to return if limiting per page
    115         'populate_extras' => true,         // Fetch the last active, where the user is a friend, total friend count, latest update
    116         'count_total'     => 'count_query' // What kind of total user count to do, if any. 'count_query', 'sql_calc_found_rows', or false
     112        'include'             => false,        // Pass comma separated list of user_ids to limit to only these users
     113        'per_page'            => 20,           // The number of results to return per page
     114        'page'                => 1,            // The page to return if limiting per page
     115        'populate_extras'     => true,         // Fetch the last active, where the user is a friend, total friend count, latest update
     116        'count_total'         => 'count_query' // What kind of total user count to do, if any. 'count_query', 'sql_calc_found_rows', or false
    117117    ), 'core_get_users' );
    118118
  • trunk/src/bp-members/bp-members-template.php

    r9976 r9977  
    305305     * @see BP_User_Query for an in-depth description of parameters.
    306306     *
    307      * @param string       $type            Sort order.
    308      * @param int          $page_number     Page of results.
    309      * @param int          $per_page        Number of results per page.
    310      * @param int          $max             Max number of results to return.
    311      * @param int          $user_id         Limit to friends of a user.
    312      * @param string       $search_terms    Limit to users matching search terms.
    313      * @param array        $include         Limit results by these user IDs.
    314      * @param bool         $populate_extras Fetch optional extras.
    315      * @param array        $exclude         Exclude these IDs from results.
    316      * @param array        $meta_key        Limit to users with a meta_key.
    317      * @param array        $meta_value      Limit to users with a meta_value (with meta_key).
    318      * @param string       $page_arg        Optional. The string used as a query parameter in pagination links.
    319      *                                      Default: 'upage'.
    320      * @param array|string $member_type     Array or comma-separated string of member types to limit results to.
     307     * @param string       $type                Sort order.
     308     * @param int          $page_number         Page of results.
     309     * @param int          $per_page            Number of results per page.
     310     * @param int          $max                 Max number of results to return.
     311     * @param int          $user_id             Limit to friends of a user.
     312     * @param string       $search_terms        Limit to users matching search terms.
     313     * @param array        $include             Limit results by these user IDs.
     314     * @param bool         $populate_extras     Fetch optional extras.
     315     * @param array        $exclude             Exclude these IDs from results.
     316     * @param array        $meta_key            Limit to users with a meta_key.
     317     * @param array        $meta_value          Limit to users with a meta_value (with meta_key).
     318     * @param string       $page_arg            Optional. The string used as a query parameter in pagination links.
     319     *                                          Default: 'upage'.
     320     * @param array|string $member_type         Array or comma-separated string of member types to limit results to.
    321321     * @param array|string $member_type__in     Array or comma-separated string of member types to limit results to.
    322      * @param array|string $member_type__not_in     Array or comma-separated string of member types to exclude from results.
     322     * @param array|string $member_type__not_in Array or comma-separated string of member types to exclude
     323     *                                          from results.
    323324     */
    324325    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 = '' ) {
     
    508509 *     string (eg, 'user_id=4&per_page=3').
    509510 *
    510  *     @type int                   $type            Sort order. Accepts 'active', 'random', 'newest', 'popular',
    511  *                                                  'online', 'alphabetical'. Default: 'active'.
    512  *     @type int|bool              $page            Page of results to display. Default: 1.
    513  *     @type int|bool              $per_page        Number of results per page. Default: 20.
    514  *     @type int|bool              $max             Maximum number of results to return. Default: false (unlimited).
    515  *     @type string                $page_arg        The string used as a query parameter in pagination links.
    516  *                                                  Default: 'bpage'.
    517  *     @type array|int|string|bool $include         Limit results by a list of user IDs. Accepts an array, a
    518  *                                                  single integer, a comma-separated list of IDs, or false (to
    519  *                                                  disable this limiting). Accepts 'active', 'alphabetical',
    520  *                                                  'newest', or 'random'. Default: false.
    521  *     @type array|int|string|bool $exclude         Exclude users from results by ID. Accepts an array, a single
    522  *                                                  integer, a comma-separated list of IDs, or false (to disable
    523  *                                                  this limiting). Default: false.
    524  *     @type int                   $user_id         If provided, results are limited to the friends of the specified
    525  *                                                  user. When on a user's Friends page, defaults to the ID of the
    526  *                                                  displayed user. Otherwise defaults to 0.
    527  *     @type string|array          $member_type     Array or comma-separated list of member types to limit results to.
    528  *     @type string|array          $member_type__in     Array or comma-separated list of member types to limit results to.
    529  *     @type string|array          $member_type__not_in     Array or comma-separated list of member types to exclude from results.
    530  *     @type string                $search_terms    Limit results by a search term. Default: null.
    531  *     @type string                $meta_key        Limit results by the presence of a usermeta key.
    532  *                                                  Default: false.
    533  *     @type mixed                 $meta_value      When used with meta_key, limits results by the
    534  *                                                  a matching usermeta value. Default: false.
    535  *     @type bool                  $populate_extras Whether to fetch optional data, such as
    536  *                                                  friend counts. Default: true.
     511 *     @type int                   $type                Sort order. Accepts 'active', 'random', 'newest', 'popular',
     512 *                                                      'online', 'alphabetical'. Default: 'active'.
     513 *     @type int|bool              $page                Page of results to display. Default: 1.
     514 *     @type int|bool              $per_page            Number of results per page. Default: 20.
     515 *     @type int|bool              $max                 Maximum number of results to return. Default: false (unlimited).
     516 *     @type string                $page_arg            The string used as a query parameter in pagination links.
     517 *                                                      Default: 'bpage'.
     518 *     @type array|int|string|bool $include             Limit results by a list of user IDs. Accepts an array, a
     519 *                                                      single integer, a comma-separated list of IDs, or false (to
     520 *                                                      disable this limiting). Accepts 'active', 'alphabetical',
     521 *                                                      'newest', or 'random'. Default: false.
     522 *     @type array|int|string|bool $exclude             Exclude users from results by ID. Accepts an array, a single
     523 *                                                      integer, a comma-separated list of IDs, or false (to disable
     524 *                                                      this limiting). Default: false.
     525 *     @type int                   $user_id             If provided, results are limited to the friends of the specified
     526 *                                                      user. When on a user's Friends page, defaults to the ID of the
     527 *                                                      displayed user. Otherwise defaults to 0.
     528 *     @type string|array          $member_type         Array or comma-separated list of member types to limit
     529 *                                                      results to.
     530 *     @type string|array          $member_type__in     Array or comma-separated list of member types to limit
     531 *                                                      results to.
     532 *     @type string|array          $member_type__not_in Array or comma-separated list of member types to exclude
     533 *                                                      from results.
     534 *     @type string                $search_terms        Limit results by a search term. Default: null.
     535 *     @type string                $meta_key            Limit results by the presence of a usermeta key.
     536 *                                                      Default: false.
     537 *     @type mixed                 $meta_value          When used with meta_key, limits results by the a matching
     538 *                                                      usermeta value. Default: false.
     539 *     @type bool                  $populate_extras     Whether to fetch optional data, such as friend counts.
     540 *                                                      Default: true.
    537541 * }
    538542 * @return bool Returns true when blogs are found, otherwise false.
     
    561565    // type: active ( default ) | random | newest | popular | online | alphabetical
    562566    $r = bp_parse_args( $args, array(
    563         'type'            => 'active',
    564         'page'            => 1,
    565         'per_page'        => 20,
    566         'max'             => false,
    567 
    568         'page_arg'        => 'upage',  // See https://buddypress.trac.wordpress.org/ticket/3679
    569 
    570         'include'         => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to only show these users
    571         'exclude'         => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to exclude these users
    572 
    573         'user_id'         => $user_id, // Pass a user_id to only show friends of this user
    574         'member_type'     => $member_type,
     567        'type'                => 'active',
     568        'page'                => 1,
     569        'per_page'            => 20,
     570        'max'                 => false,
     571
     572        'page_arg'            => 'upage',  // See https://buddypress.trac.wordpress.org/ticket/3679
     573
     574        'include'             => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to only show these users
     575        'exclude'             => false,    // Pass a user_id or a list (comma-separated or array) of user_ids to exclude these users
     576
     577        'user_id'             => $user_id, // Pass a user_id to only show friends of this user
     578        'member_type'         => $member_type,
    575579        'member_type__in'     => '',
    576         'member_type__not_in'     => '',
    577         'search_terms'    => null,     // Pass search_terms to filter users by their profile data
    578 
    579         'meta_key'        => false,    // Only return users with this usermeta
    580         'meta_value'      => false,    // Only return users where the usermeta value matches. Requires meta_key
    581 
    582         'populate_extras' => true      // Fetch usermeta? Friend count, last active etc.
     580        'member_type__not_in' => '',
     581        'search_terms'        => null,     // Pass search_terms to filter users by their profile data
     582
     583        'meta_key'            => false,    // Only return users with this usermeta
     584        'meta_value'          => false,    // Only return users where the usermeta value matches. Requires meta_key
     585
     586        'populate_extras'     => true      // Fetch usermeta? Friend count, last active etc.
    583587    ), 'has_members' );
    584588
Note: See TracChangeset for help on using the changeset viewer.