cvs diff: Diffing . ? .project Index: masquerade.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/masquerade/masquerade.module,v retrieving revision 1.16.2.26 diff -u -p -r1.16.2.26 masquerade.module --- masquerade.module 4 Sep 2009 17:07:21 -0000 1.16.2.26 +++ masquerade.module 4 Sep 2009 20:58:22 -0000 @@ -429,7 +429,13 @@ function masquerade_block_1_validate($fo form_set_error('masquerade_user_field', t('You are already masquerading. Please switch back to your account to masquerade as another user.', array('@unswitch' => url('masquerade/unswitch')))); } global $user; - $masq_user = user_load(array('name' => $form_state['values']['masquerade_user_field'])); + if (module_exists('alt_login')) { + $alt_login = db_fetch_object(db_query("SELECT u.name FROM {users} u INNER JOIN {alt_login} al ON u.uid = al.uid WHERE al.alt_login = '%s'", $name)); + if ($alt_login->name) { + $name = $alt_login->name; + } + } + $masq_user = user_load(array('name' => $name)); if (!$masq_user) { form_set_error('masquerade_user_field', t('User %masq_as does not exist. Please enter a valid username.', array('%masq_as' => $form_state['values']['masquerade_user_field']))); } @@ -459,6 +465,12 @@ function masquerade_autocomplete($string while ($user = db_fetch_object($result)) { $matches[$user->name] = check_plain($user->name); } + if (module_exists('alt_login')) { + $result = db_query_range("SELECT alt_login FROM {alt_login} u WHERE LOWER(alt_login) LIKE LOWER('%s%%')", $string, 0, 10); + while ($user = db_fetch_object($result)) { + $matches[$user->alt_login] = check_plain($user->alt_login); + } + } if (module_exists('devel')) { $GLOBALS['devel_shutdown'] = FALSE; }