First time login (event, action)

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com我們的新網頁設計公司網頁.

/**
 * 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