Skip to:
Content

BuddyPress.org

Ticket #7325: 7325-friends-anonymous-functions.diff

File 7325-friends-anonymous-functions.diff, 970 bytes (added by tw2113, 3 years ago)
  • src/bp-friends/classes/class-bp-friends-friendship.php

    diff --git src/bp-friends/classes/class-bp-friends-friendship.php src/bp-friends/classes/class-bp-friends-friendship.php
    index 778738a..2973b7f 100644
    class BP_Friends_Friendship { 
    644644                $last_activities = BP_Core_User::get_last_activity( $user_ids );
    645645
    646646                // Sort and structure as expected in legacy function.
    647                 usort( $last_activities, create_function( '$a, $b', '
    648                         if ( $a["date_recorded"] == $b["date_recorded"] ) {
     647                usort( $last_activities, function( $a, $b ) {
     648                        if ( $a['date_recorded'] == $b['date_recorded'] ) {
    649649                                return 0;
    650650                        }
    651651
    652                         return ( strtotime( $a["date_recorded"] ) < strtotime( $b["date_recorded"] ) ) ? 1 : -1;
    653                 ' ) );
     652                        return ( strtotime( $a['date_recorded'] ) < strtotime( $b['date_recorded'] ) ) ? 1 : - 1;
     653                } );
    654654
    655655                $retval = array();
    656656                foreach ( $last_activities as $last_activity ) {