Skip to:
Content

BuddyPress.org

Ticket #4305: 4305.01.patch

File 4305.01.patch, 1.1 KB (added by r-a-y, 12 years ago)
  • bp-messages/bp-messages-functions.php

    function messages_new_message( $args = '' ) { 
    6868                // Loop the recipients and convert all usernames to user_ids where needed
    6969                foreach( (array) $recipients as $recipient ) {
    7070                        $recipient = trim( $recipient );
     71
    7172                        if ( empty( $recipient ) )
    7273                                continue;
    7374
     75                        $recipient_id = false;
     76
     77                        // input was numeric
    7478                        if ( is_numeric( $recipient ) ) {
     79                                // do a check against the user ID column first
    7580                                if ( bp_core_get_core_userdata( (int) $recipient ) )
    7681                                        $recipient_id = (int) $recipient;
    7782
     83                                // if that fails, check against the user_login / user_nicename column
     84                                else {
     85                                        if ( bp_is_username_compatibility_mode() )
     86                                                $recipient_id = bp_core_get_userid( (int) $recipient );
     87                                        else
     88                                                $recipient_id = bp_core_get_userid_from_nicename( (int) $recipient );
     89                                }
     90
    7891                        } else {
    7992                                if ( bp_is_username_compatibility_mode() )
    8093                                        $recipient_id = bp_core_get_userid( $recipient );