cvs diff: Diffing . ? .project Index: masquerade.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/masquerade/masquerade.module,v retrieving revision 1.16.2.27 diff -u -p -r1.16.2.27 masquerade.module --- masquerade.module 10 Sep 2009 20:13:15 -0000 1.16.2.27 +++ masquerade.module 10 Sep 2009 20:16:38 -0000 @@ -427,6 +427,7 @@ function masquerade_block_1($record) { * Masquerade block form validation. */ function masquerade_block_1_validate($form, &$form_state) { + global $user; unset($form); $name = $form_state['values']['masquerade_user_field']; if ($name == variable_get('anonymous', t('Anonymous'))) { @@ -435,8 +436,13 @@ function masquerade_block_1_validate($fo if ($_SESSION['masquerading']) { 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']))); } @@ -494,6 +500,12 @@ function masquerade_autocomplete_multipl while ($user = db_fetch_object($result)) { $matches[$prefix . $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; }