Check if user is logged in first time How can i check if user is logged in for the first time on site?

If it is, i want to show him a message...

Can someone help me?

Thank you!
** UPDATE **

As suggested by oknate, using hook_user_login:

function hook_user_login(&amp;$edit, $account)
{
  if(!$account-&gt;access)
  {
    drupal_set_message(t('This is your first login. Welcome!'));
  }
}


** Original less optimal method **

You can use hook_init() in D7, and check if they have a value for last access:

function hook_init()
{
  global $user;

  $first_login = db_query('SELECT 1 FROM {users} WHERE uid = :uid AND access = 0', array(':uid' =&gt; $user-&gt;uid))-&gt;fetchField();

  if($first_login)
  {
    drupal_set_message(t('This is your first login. Welcome!'));
  }
}