Index: privatemsg.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.module,v retrieving revision 1.70.2.30.2.91.2.64.2.73 diff -u -p -r1.70.2.30.2.91.2.64.2.73 privatemsg.module --- privatemsg.module 12 Jul 2010 08:21:42 -0000 1.70.2.30.2.91.2.64.2.73 +++ privatemsg.module 12 Jul 2010 09:01:20 -0000 @@ -836,11 +836,12 @@ function _privatemsg_parse_userstring($i } } } + + // Remove optonal user specifier. + $string = trim(str_replace(t('[user]'), '', $string)); // Fall back to the default username lookup. if (!$error = module_invoke('user', 'validate_name', $string)) { // String is a valid username, look it up. - // Remove optonal user specifier. - $string = str_replace('[user]', '', $string); if ($recipient = user_load_by_name($string)) { $recipient->recipient = $recipient->uid; $recipient->type = 'user'; Index: privatemsg.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/privatemsg/privatemsg.test,v retrieving revision 1.2.2.1.2.28 diff -u -p -r1.2.2.1.2.28 privatemsg.test --- privatemsg.test 12 Jul 2010 05:15:21 -0000 1.2.2.1.2.28 +++ privatemsg.test 12 Jul 2010 09:01:20 -0000 @@ -209,9 +209,9 @@ class PrivatemsgTestCase extends DrupalW $this->drupalLogin($author); $this->drupalGet('messages/new'); - // Prepare edit arrays, single recipient. + // Prepare edit arrays, single recipient with [user]. $edit = array( - 'recipient' => $recipient->name, + 'recipient' => $recipient->name . ' [user]', 'subject' => $this->randomName(20), 'body[value]' => $this->randomName(100), );