You are here

function legal_login_submit in Legal 6.8

Same name and namespace in other branches
  1. 5 legal.module \legal_login_submit()
  2. 6.7 legal.module \legal_login_submit()
  3. 7.2 legal.module \legal_login_submit()
  4. 7 legal.module \legal_login_submit()

File

./legal.module, line 554
Displays Terms & Conditions, and makes sure they are accepted before registration is accepted.

Code

function legal_login_submit($form, &$form_state) {
  global $user;
  $values = $form_state['values'];
  $user = user_load(array(
    'uid' => $values['uid'],
  ));
  legal_save_accept($values['version'], $values['revision'], $values['language'], $user->uid);
  watchdog('legal', '%name accepted T&C version %tc_id.', array(
    '%name' => $user->name,
    '%tc_id' => $values['tc_id'],
  ));

  // Update the user table timestamp noting user has logged in.
  db_query("UPDATE {users} SET login = '%d' WHERE uid = '%s'", time(), $user->uid);

  // User has new permissions, so we clear their menu cache.
  cache_clear_all($user->uid, 'cache_menu', TRUE);

  // Fixes login problems in Pressflow.
  sess_regenerate();
  user_module_invoke('login', $edit, $user);
}