You are here

function masquerade_block_1_submit in Masquerade 5

Same name and namespace in other branches
  1. 6 masquerade.module \masquerade_block_1_submit()
  2. 7 masquerade.module \masquerade_block_1_submit()

Masquerade block form submission. Implementation of hook_submit().

File

./masquerade.module, line 296
masquerade.module

Code

function masquerade_block_1_submit($form_id, $form_values) {
  $masq_user = user_load(array(
    'name' => $form_values['masquerade_user_field'],
  ));
  if (module_exists('alt_login')) {

    // alt_login.module integration patch by espie.
    $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) {
      $masq_user = user_load(array(
        'name' => $alt_login->name,
      ));
    }
  }
  masquerade_switch_user($masq_user->uid);
}