[buddypress-trac] [BuddyPress Trac] #7601: Add user_id to $results array for easier filtering of autocompletes

buddypress-trac noreply at wordpress.org
Mon Sep 25 22:39:06 UTC 2017


#7601: Add user_id to $results array for easier filtering of autocompletes
-----------------------------+-----------------
 Reporter:  bradmkjr         |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:
Component:  Core             |    Version:
 Severity:  normal           |   Keywords:
-----------------------------+-----------------
 When trying to filter users in autocomplete, it would be better if user_id
 was included in the $results array, so a user lookup would not be required
 to get the user_id from the user_nicename


 bp-core/classes/class-bp-members-suggestions.php

 {{{#!php
 <?php
                 foreach ( $user_query->results as $user ) {
                         $result        = new stdClass();
                         $result->ID    = $user->user_nicename;
                         $result->image = bp_core_fetch_avatar( array(
 'html' => false, 'item_id' => $user->ID ) );
                         $result->name  = bp_core_get_user_displayname(
 $user->ID );

                         $results[] = $result;
                 }
 }}}

 Could change to:

 {{{#!php
 <?php
                 foreach ( $user_query->results as $user ) {
                         $result        = new stdClass();
                         $result->ID    = $user->user_nicename;
                         $result->user_id    = $user->ID;
                         $result->image = bp_core_fetch_avatar( array(
 'html' => false, 'item_id' => $user->ID ) );
                         $result->name  = bp_core_get_user_displayname(
 $user->ID );

                         $results[] = $result;
                 }
 }}}

 Thank You

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7601>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list