Hook user login never gets called? We have an existing application with users and we would like to get our user base to accept the terms and conditions. In this regard I did some research and see that legal module comes the closest to desired functionality however there is one concern:

By default the legal module only shows up on login when a user has accepted terms and conditions on registration and only if the terms have changed. What we want to do is to get every user to see that upon login until they accept them. 

I looked at the module code and see there is a hook_login function. No matter what I do, this function does not get called. I have tried to backtrace the login system and find out that certain modules do get their hook user login called but some do not. Legal module would be one of them. Any thoughts on how to trouble shoot this further?

The hook is as follows: 

function legal_user_login(&amp;$edit, $account) {
  echo "Legal module hook login called"; &lt;--- never see this
  exit; &lt;-- does not get called


  global $user;
  global $language;

  if ($user-&gt;uid == 1) {
    return;
  }

  // Get last accepted version for this account
  $legal_account = legal_get_accept($user-&gt;uid);

  // If no version has been accepted yet, get version with current language revision.
  if (empty($legal_account['version'])) {
    $conditions = legal_get_conditions($language-&gt;language);
    // No conditions set yet.
    if (empty($conditions['conditions'])) {
      return;
    }
  }
  // Get version / revision of last accepted language.
  else {
    $conditions = legal_get_conditions($legal_account['language']);
    // No conditions set yet.
    if (empty($conditions['conditions'])) {
      return;
    }

    // Check latest version of T&amp;C has been accepted.
    $accepted = legal_version_check($user-&gt;uid, $conditions['version'], $conditions['revision'], $legal_account);

    if ($accepted) {
      return;
    }
  }

  $uid = $user-&gt;uid;

  // Log the user out and regenerate the Drupal session.
  module_invoke_all('user_logout', $user);
  drupal_session_regenerate();

  // We have to use $GLOBALS to unset a global variable.
  $user = drupal_anonymous_user();

  $query = NULL;

  // Deal with destination from password reset one time login link,
  // by creating a new one time login link and setting it as the destination
  // after the T&amp;Cs have been accepted.
  if (arg(0) == 'user' &amp;&amp; arg(1) == 'reset') {
    $token = drupal_hash_base64(drupal_random_bytes(55));
    // This is a new, anonymous-user session.
    $_SESSION['pass_reset_' . $uid] = $token;
    $query = array('destination' =&gt; "user/$uid/edit?pass-reset-token=$token");
  }

  if (!empty($_REQUEST['destination'])) {
    $query = array('destination' =&gt; $_REQUEST['destination']);
  }

  unset($_GET['destination']);

  $result    = db_select('users', 'u')
    -&gt;fields('u')
    -&gt;condition('uid', $uid)
    -&gt;range(0, 1)
    -&gt;execute()
    -&gt;fetchAllAssoc('uid');
  $signatory = array_pop($result);

  drupal_goto('legal_accept/' . $signatory-&gt;uid . '/' . md5($signatory-&gt;name . $signatory-&gt;pass . $signatory-&gt;login), array('query' =&gt; $query));
}
Just add a (boolean) field to the user.


  For new Drupal 7 site you can use:
  
  Admin > Configuration > People > Account settings > Manage fields
  Another method is using Profile2 module, a successor of Content
  Profile Drupal 6 module If you have started with a minimal install
  profile you will need to enable the Field UI module to access Manage
  fields via the Account settings.


Then, in a custom module, invoke hook_user_load and there, check if it's set. If not redirect to a page where the user needs to accept the terms and this field get updated.

Or, have a look at EU cookie compliance, it does more or less what you want.