You are here

function privatemsg_user_cancel in Privatemsg 7

Same name and namespace in other branches
  1. 7.2 privatemsg.module \privatemsg_user_cancel()

Implements hook_user_cancel().

File

./privatemsg.module, line 1278
Allows users to send private messages to other users.

Code

function privatemsg_user_cancel($edit, $account, $method) {
  switch ($method) {
    case 'user_cancel_reassign':
      db_update('pm_message')
        ->condition('author', $account->uid)
        ->fields(array(
        'author' => 0,
      ))
        ->execute();
      break;
    case 'user_cancel_block_unpublish':
      _privatemsg_delete_data($account);
      break;
  }

  // Always delete user settings.
  db_delete('pm_disable')
    ->condition('uid', $account->uid)
    ->execute();
}