Category Archives: MISCELLANEOUS

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.

Example:

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.

User Register Hook

Hook’s name: uultra_registration_hook

This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument.

Typically, this hook is used for saving additional user meta passed by custom registration forms.

Example:

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

function uultra_registration_hook($user_id)
{
   //do your stuff
   update_user_meta($user_id, 'uuultra_custom_hook_name', 'yea it worked');

}

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