Skip to:
Content

Changeset 11354


Ignore:
Timestamp:
12/29/2016 02:35:08 AM (19 months ago)
Author:
boonebgorges
Message:

Replace calls to deprecated user query in friends legacy functions.

Props tw2113.
Fixes #6889.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/bp-friends-functions.php

    r11022 r11354  
    422422 */
    423423function friends_get_recently_active( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
     424    $friends = bp_core_get_users( array(
     425        'type'         => 'active',
     426        'per_page'     => $per_page,
     427        'page'         => $page,
     428        'user_id'      => $user_id,
     429        'search_terms' => $filter,
     430    ) );
    424431
    425432    /**
     
    428435     * @since 1.2.0
    429436     *
    430      * @param array {
     437     * @param array $friends {
    431438     *     @type int   $total_users Total number of users matched by query params.
    432439     *     @type array $paged_users The current page of users matched by query params.
    433440     * }
    434441     */
    435     return apply_filters( 'friends_get_recently_active', BP_Core_User::get_users( 'active', $per_page, $page, $user_id, $filter ) );
     442    return apply_filters( 'friends_get_recently_active', $friends );
    436443}
    437444
     
    453460 */
    454461function friends_get_alphabetically( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
     462    $friends = bp_core_get_users( array(
     463        'type'         => 'alphabetical',
     464        'per_page'     => $per_page,
     465        'page'         => $page,
     466        'user_id'      => $user_id,
     467        'search_terms' => $filter,
     468    ) );
    455469
    456470    /**
     
    459473     * @since 1.2.0
    460474     *
    461      * @return array {
     475     * @return array $friends {
    462476     *     @type int   $total_users Total number of users matched by query params.
    463477     *     @type array $paged_users The current page of users matched by query params.
    464478     * }
    465479     */
    466     return apply_filters( 'friends_get_alphabetically', BP_Core_User::get_users( 'alphabetical', $per_page, $page, $user_id, $filter ) );
     480    return apply_filters( 'friends_get_alphabetically', $friends );
    467481}
    468482
     
    484498 */
    485499function friends_get_newest( $user_id, $per_page = 0, $page = 0, $filter = '' ) {
     500    $friends = bp_core_get_users( array(
     501        'type'         => 'newest',
     502        'per_page'     => $per_page,
     503        'page'         => $page,
     504        'user_id'      => $user_id,
     505        'search_terms' => $filter,
     506    ) );
    486507
    487508    /**
     
    490511     * @since 1.2.0
    491512     *
    492      * @param array {
     513     * @param array $friends {
    493514     *     @type int   $total_users Total number of users matched by query params.
    494515     *     @type array $paged_users The current page of users matched by query params.
    495516     * }
    496517     */
    497     return apply_filters( 'friends_get_newest', BP_Core_User::get_users( 'newest', $per_page, $page, $user_id, $filter ) );
     518    return apply_filters( 'friends_get_newest', $friends );
    498519}
    499520
  • trunk/tests/phpunit/testcases/friends/functions.php

    r11353 r11354  
    335335
    336336    public function test_friends_get_recently_active() {
    337         $this->setExpectedDeprecated( 'BP_Core_User::get_users' );
    338337        $u1 = $this->factory->user->create();
    339338        $u2 = $this->factory->user->create();
     
    358357
    359358    public function test_friends_get_alphabetically() {
    360         $this->setExpectedDeprecated( 'BP_Core_User::get_users' );
    361359        $u1 = $this->factory->user->create();
    362360        $u2 = $this->factory->user->create();
     
    370368        xprofile_set_field_data( $field_id, $u2, 'Dave Lister' );
    371369        xprofile_set_field_data( $field_id, $u3, 'Arnold Rimmer' );
     370        xprofile_sync_wp_profile( $u2 );
     371        xprofile_sync_wp_profile( $u3 );
    372372
    373373        $alpha = friends_get_alphabetically( $u1 );
     
    378378
    379379    public function test_friends_get_newest() {
    380         $this->setExpectedDeprecated( 'BP_Core_User::get_users' );
    381380        $u1 = $this->factory->user->create();
    382381        $u2 = $this->factory->user->create();
Note: See TracChangeset for help on using the changeset viewer.