Skip to:
Content

BuddyPress.org

Changeset 1957


Ignore:
Timestamp:
09/25/2009 10:15:42 PM (15 years ago)
Author:
apeatling
Message:

Moving autocomplete results function to deprecated file as it is now in the theme and was causing duplicate results.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages.php

    r1952 r1957  
    556556}
    557557
    558 function messages_ajax_autocomplete_results() {
    559     global $bp;
    560    
    561     $friends = false;
    562 
    563     // Get the friend ids based on the search terms
    564     if ( function_exists( 'friends_search_friends' ) )
    565         $friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 );
    566 
    567     $friends = apply_filters( 'bp_friends_autocomplete_list', $friends, $_GET['q'], $_GET['limit'] );
    568 
    569     if ( $friends['friends'] ) {
    570         foreach ( $friends['friends'] as $user_id ) {
    571             $ud = get_userdata($user_id);
    572             $username = $ud->user_login;
    573             echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) )  . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
    574             ';
    575         }       
    576     }
    577 }
    578 add_action( 'wp_ajax_messages_autocomplete_results', 'messages_ajax_autocomplete_results' );
    579 
    580 
    581558// List actions to clear super cached pages on, if super cache is installed
    582559add_action( 'messages_delete_thread', 'bp_core_clear_cache' );
  • trunk/bp-messages/deprecated/bp-messages-deprecated.php

    r1905 r1957  
    162162add_action( 'wp_ajax_messages_close_notice', 'messages_ajax_close_notice' );
    163163
     164function messages_ajax_autocomplete_results() {
     165    global $bp;
     166
     167    /* If we are using a BuddyPress 1.1+ theme ignore this. */
     168    if ( !file_exists( WP_CONTENT_DIR . '/bp-themes' ) )
     169        return false;
     170           
     171    $friends = false;
     172
     173    // Get the friend ids based on the search terms
     174    if ( function_exists( 'friends_search_friends' ) )
     175        $friends = friends_search_friends( $_GET['q'], $bp->loggedin_user->id, $_GET['limit'], 1 );
     176
     177    $friends = apply_filters( 'bp_friends_autocomplete_list', $friends, $_GET['q'], $_GET['limit'] );
     178
     179    if ( $friends['friends'] ) {
     180        foreach ( $friends['friends'] as $user_id ) {
     181            $ud = get_userdata($user_id);
     182            $username = $ud->user_login;
     183            echo bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) )  . ' ' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
     184            ';
     185        }       
     186    }
     187}
     188add_action( 'wp_ajax_messages_autocomplete_results', 'messages_ajax_autocomplete_results' );
     189
    164190/* Deprecated -- use messages_new_message() */
    165191function messages_send_message( $recipients, $subject, $content, $thread_id, $from_ajax = false, $from_template = false, $is_reply = false ) {
Note: See TracChangeset for help on using the changeset viewer.