Skip to:
Content

BuddyPress.org


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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.