Skip to:
Content

BuddyPress.org

Changeset 2702 for trunk/bp-core.php


Ignore:
Timestamp:
02/12/2010 02:14:20 PM (16 years ago)
Author:
apeatling
Message:

Fixing up API so it is consistent for get_users, get_groups and get_blogs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core.php

    r2695 r2702  
    520520
    521521/**
     522 * bp_core_get_users()
     523 *
     524 * Return an array of users IDs based on the parameters passed.
     525 *
     526 * @package BuddyPress Core
     527 */
     528function bp_core_get_users( $args = '' ) {
     529        global $bp;
     530
     531        $defaults = array(
     532                'type' => 'active', // active, newest, alphabetical, random or popular
     533                'user_id' => false, // Pass a user_id to limit to only friend connections for this user
     534                'search_terms' => false, // Limit to users that match these search terms
     535
     536                'per_page' => 20, // The number of results to return per page
     537                'page' => 1, // The page to return if limiting per page
     538                'populate_extras' => true, // Fetch the last active, where the user is a friend, total friend count, latest update
     539        );
     540
     541        $params = wp_parse_args( $args, $defaults );
     542        extract( $params, EXTR_SKIP );
     543
     544        return apply_filters( 'bp_core_get_users', BP_Core_User::get_users( $type, $per_page, $page, $user_id, $search_terms, $populate_extras ), &$params );
     545}
     546
     547/**
    522548 * bp_core_get_user_domain()
    523549 *
     
    954980
    955981        if ( isset( $_GET['random-member'] ) ) {
    956                 $user = BP_Core_User::get_users( 'random', 1 );
     982                $user = bp_core_get_users( array( 'type' => 'random', 'per_page' => 1 ) );
    957983                bp_core_redirect( bp_core_get_user_domain( $user['users'][0]->id ) );
    958984        }
Note: See TracChangeset for help on using the changeset viewer.