You are here

function persistent_login_erase in Persistent Login 7

Same name and namespace in other branches
  1. 5 persistent_login.module \persistent_login_erase()
  2. 6 persistent_login.pages.inc \persistent_login_erase()

Menu callback to erase a user's Persistent Login records. The menu entry guarantees that the user is logged in.

Redirects to user/$uid if allowed or calls drupal_access_denied().

Parameters

$uid: The user id for whom to erase PL records. A user can specify any uid for the callback, but only the current user's id will work unless the user has 'administer persistent login' permission.

1 string reference to 'persistent_login_erase'
persistent_login_menu in ./persistent_login.module
Implements hook_menu().

File

./persistent_login.pages.inc, line 114
Implementation of Persistent Login forms.

Code

function persistent_login_erase($uid = NULL) {
  global $user;
  if (!isset($uid)) {
    $uid = $user->uid;
  }
  if ($user->uid == $uid || user_access('administer persistent login')) {
    _persistent_login_invalidate('erase', 'uid = :uid', array(
      ':uid' => $uid,
    ));
    drupal_goto('user/' . $uid);
  }
  drupal_access_denied();
}