Best Practice for Deleting CiviCRM Contacts and Associated Drupal User Account
Because of the way the synchronization process works with the UF_Match table, deleting records can be tricky business. If done in the incorrect order, your CiviCRM database can end up with a bunch of Junk contact records. Below is a best practice process for removing records, first the Drupal user record should be deleted then the CiviCRM record.
Process to Follow
Step 1 - Identify the Identify the Contact record(s) to be merged/removed in CiviCRM and note the Drupal User ID for the record to be removed.
Step 2 - Search for and locate the Drupal record for the CiviCRM Contact you are deleting that you identified in Step 1 and use the Cancel Account button to delete the Drupal User record.
Step 3 - Go back to CiviCRM and merge/delete the CiviCRM Contact record.
- Identify the Contact record(s) to be merged/removed in CiviCRM.
- Determine the record which is to be removed and note the Drupal User ID.
- From the Drupal People screen, locate the User record to be removed. Note that the Drupal ID number should match the User ID from the CiviCRM Contact record.
- At the bottom of the Edit/Account tab, choose Cancel account.
- Merge/Remove the CiviCRM Contact record(s) as normal in CivCRM.
Restoring a CiviCRM record from Trash
If you have accidently deleted a Contact record from CiviCRM, you should follow the process in the order outlined below to restore the contact and reestablish a Drupal User account.
Process to Follow
- Step 1 - Restore the CiviCRM Contact record from the trash.
- Step 2 - Establish the connection to a Drupal User account.
If you have not yet deleted the Drupal User account that was associated with the deleted CiviCRM record and you edit the Drupal User account (from Drupal) that was associated previously, Drupal will reestablish the link to the CiviCRM record.
If there is not an existing Drupal User account, you can create a new Drupal user account for the record through the normal CiviCRM process.