User After Login Hook

Hook’s name: uultra_after_login_hook

This action hook allows you to perform your own actions right after the user has logged in. The $user_login variables is passed to hook as an argument.

Typically, this hook is used for saving additional user meta right after the user has logged in. The following example will save the current time as meta field.


Place the following function within the functions.php file which is in your theme’s folder:

function uultra_after_login_hook($user_login)
   //do your stuff
  //update last login
  $user = get_user_by( 'login', $user_login );
  $current_time = date("Y-m-d H:i:s"); 
  update_user_meta($user->ID, 'user_last_login', $current_time);	

PLEASE NOTE: This is an example, you would need to write your own coding within the “uultra_after_login_hook” function.