4.7.x user.module user_login_submit($form_id, $form_values)
5.x user.module user_login_submit($form_id, $form_values)
6.x user.module user_login_submit($form, &$form_state)
7.x user.module user_login_submit($form, &$form_state)

Submit handler for the login form. Load $user object and perform standard login tasks. The user is then redirected to the My Account page. Setting the destination in the query string overrides the redirect.

3 calls to user_login_submit()
openid_authentication in modules/openid/openid.module
Authenticate a user or attempt registration.
user_external_login_register in modules/user/user.module
Helper function for authentication modules. Either logs in or registers the current user, based on username. Either way, the global $user object is populated and login tasks are performed.
user_register_submit in modules/user/user.module
Submit handler for the user registration form.
1 string reference to 'user_login_submit'
user_login_block in modules/user/user.module

File

modules/user/user.module, line 2316
Enables the user registration and login system.

Code

function user_login_submit($form, &$form_state) {
  global $user;
  $user = user_load($form_state['uid']);
  $form_state['redirect'] = 'user/' . $user->uid;

  user_login_finalize($form_state);
}

Comments

randomyao22’s picture

In the function docs it says "Setting the destination in the query string overrides the redirect."
Not very clear how to do it. Can anybody give a sample?

ryan88’s picture

What that means is if you provide a destination in the url, it will override the redirect in this function.

So if a user is on this page: http://yoursite/user/login?destination=node/1, then once they log in, they would go to node/1

Romisha’s picture

I am using fboauth module and created a custom service for facebook login. If validated, then I am using user_login_submit for pragmatically login a user. But its not creating a session in Drupal. I checked and found that drupal_save_session() is returning false in drupal_session_regenerate() function. Can someone please explain me why?