First time login (event, action)

/**
 * Implementation of hook_user
 */
function modulename_user ($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'insert':
      $edit['first_time_login'] = 1;
      break;
    case 'login':
      $data = unserialize($account->data);
      if ($data['first_time_login']) {
        user_save($account, array('first_time_login' => 0));
        drupal_set_message (t('This is your first time login.'));
      }
      break;
  }
}
Help Share this Article