Skip to:
Content

BuddyPress.org

Changeset 4294


Ignore:
Timestamp:
04/25/2011 02:25:30 PM (15 years ago)
Author:
djpaul
Message:

Fix private messaging recipients to work when BP_ENABLE_USERNAME_COMPATIBILITY_MODE is not set and user_nicename != user_login. See #3104

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-messages/bp-messages-functions.php

    r4164 r4294  
    5858                // Loop the recipients and convert all usernames to user_ids where needed
    5959                foreach( (array) $recipients as $recipient ) {
    60                         if ( is_numeric( trim( $recipient ) ) )
    61                                 $recipient_ids[] = (int)trim( $recipient );
    62 
    63                         if ( $recipient_id = bp_core_get_userid( trim( $recipient ) ) )
    64                                 $recipient_ids[] = (int)$recipient_id;
     60                        $recipient = trim( $recipient );
     61                        if ( empty( $recipient ) )
     62                                continue;
     63
     64                        if ( is_numeric( $recipient ) ) {
     65                                if ( bp_core_get_core_userdata( (int) $recipient ) )
     66                                        $recipient_ids[] = (int) $recipient;
     67
     68                        } else {
     69                                if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     70                                        $recipient_id = bp_core_get_userid( $recipient );
     71                                else
     72                                        $recipient_id = bp_core_get_userid_from_nicename( $recipient );
     73
     74                                $recipient_ids[] = (int) $recipient_id;
     75                        }
    6576                }
    6677
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r4255 r4294  
    642642        }
    643643
    644 
    645644        if ( !empty( $user_ids ) ) {
    646645                foreach ( $user_ids as $user_id ) {
    647                         $ud = get_userdata($user_id);
    648                         $username = $ud->user_login;
     646                        $ud = get_userdata( $user_id );
     647                        if ( !$ud )
     648                                continue;
     649
     650                        if ( defined( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE' ) )
     651                                $username = $ud->user_login;
     652                        else
     653                                $username = $ud->user_nicename;
     654
    649655                        echo '<span id="link-' . $username . '" value="' . bp_core_get_user_domain( $user_id ) . '"></span>' . bp_core_fetch_avatar( array( 'item_id' => $user_id, 'type' => 'thumb', 'width' => 15, 'height' => 15 ) ) . ' &nbsp;' . bp_core_get_user_displayname( $user_id ) . ' (' . $username . ')
    650656                        ';
Note: See TracChangeset for help on using the changeset viewer.