You are here

function trigger_example_user_login in Examples for Developers 7

Implements hook_user_login().

User first login trigger: Run actions on user first login.

The event "User first time login" does not exist, we should create it before it can be used. We use hook_user_login to be informed when a user logs in and try to find if the user has previously logged in before. If the user has not accessed previously, we make a call to our trigger function.

Related topics

File

trigger_example/trigger_example.module, line 158
Trigger definition example module.

Code

function trigger_example_user_login(&$edit, $account, $category = NULL) {

  // Verify user has never accessed the site: last access was creation date.
  if ($account->access == 0) {

    // Call the aproppriate trigger function.
    _trigger_example_first_time_login('user_first_time_login', $edit, $account, $category);
  }
}