Advertisement
Guest User

Untitled

a guest
Jul 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. protected function drupalLogin(stdClass $user) {
  2.  
  3.     if (!module_exists('zagat_users')) {
  4.       return parent::drupalLogin($user);
  5.     }
  6.  
  7.     if ($this->loggedInUser) {
  8.       $this->drupalLogout();
  9.     }
  10.  
  11.     $edit = array(
  12.       'name' => $user->name,
  13.       'pass' => $user->pass_raw
  14.     );
  15.     $this->drupalPost('user', $edit, t('Sign In'));
  16.  
  17.     // If a "log out" link appears on the page, it is almost certainly because
  18.     // the login was successful.
  19.     $pass = $this->assertLink(t('Log out'), 0, t('User %name successfully logged in.', array('%name' => $user->name)), t('User login'));
  20.  
  21.     if ($pass) {
  22.       $this->loggedInUser = $user;
  23.     }
  24.   }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement