You are here

function masquerade_user_delete in Masquerade 7

Implements hook_user_delete().

File

./masquerade.module, line 535
The masquerade module allows administrators to masquerade as other user.

Code

function masquerade_user_delete($account) {

  // Cleanup tables.
  $query = db_delete('masquerade_users');
  $conditions = db_or();
  $conditions
    ->condition('uid_from', $account->uid);
  $conditions
    ->condition('uid_to', $account->uid);
  $query
    ->condition($conditions);
  $query
    ->execute();

  // Cleanup variables.
  $switches = variable_get('masquerade_quick_switches', array());
  $switches_new = array_diff($switches, array(
    $account->uid,
  ));
  if ($switches != $switches_new) {
    variable_set('masquerade_quick_switches', $switches_new);

    // @TODO Implement block cache cleaning.
    menu_rebuild();
  }
}