Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Critical
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4
-
Fix Version/s: 4.0.5
-
Component/s: Core CiviCRM
-
Labels:None
Description
Deleting a Drupal user account truncates the civicrm_uf_match table.
This issue happens because the call to hook_user_delete (civicrm_user_delete civicrm_user.inc line 111) happens after the $user object is Null. Consequently the call to CRM_Core_BAO_UFMatch::deleteUser happens with nothing int he $user->uid element which means the CRM_Core_DAO_UFMatch::delete() call ends up deleting everything where the civicrm_uf_match.domain_id field = 1 each time someone deletes a Drupal user.
Patch attached here, basic principal is use the $edit-uid in lieu of $user->uid. Issue only affects 4.0 as hook_user_delete() is new in 4.0