You are here

function redhen_contact_user_cancel in RedHen CRM 7

Implements hook_user_cancel().

File

modules/redhen_contact/redhen_contact.module, line 657
Module file for RedHen contacts.

Code

function redhen_contact_user_cancel($edit, $account, $method) {
  switch ($method) {
    case 'user_cancel_block_unpublish':

      // Archive the contact, but keep the association.
      if ($contact = redhen_contact_load_by_user($account)) {
        $contact
          ->setState(REDHEN_STATE_ARCHIVED);
        $contact
          ->save();
      }
      break;
    case 'user_cancel_reassign':

      // Unlink the entities, but do not archive the contact.
      if ($contact = redhen_contact_load_by_user($account)) {
        $contact
          ->deleteUser(TRUE);
        $contact
          ->save();
      }
      break;
  }
}