Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
in moneysuite/ms_core/ms_products/ms_products.module line 401 is function ms_products_user_cancel which does:
/**
* Implements hook_user_cancel().
*/
function ms_products_user_cancel($edit, $account, $method) {
// Delete all purchases related to a user when the user is deleted.
$result = db_delete('ms_products_purchases')
->condition('uid', $account->uid)
->execute();
return $result;
}
When I canceled two user accounts and chose "Disable the account and keep its content. ", I saw that the records were deleted from ms_products_purchases.
It seems that function hook_user_delete is the correct choice for the deletion of ms_products_purchases.
I will provide a patch shortly.
Comment | File | Size | Author |
---|---|---|---|
#4 | modified-product-puchases-record-deletion_2938450-4.patch | 1.01 KB | hkovacs |
Comments
Comment #2
hkovacs CreditAttribution: hkovacs as a volunteer commentedAnother idea is to check the method of the hook_user_cancel. I will implement that first and see what you guys think.
Comment #3
hkovacs CreditAttribution: hkovacs as a volunteer commentedInteresting that I see that you have function ms_products_user_delete further down on line 1773.
Comment #4
hkovacs CreditAttribution: hkovacs commentedHere is my patch.
Since function ms_products_user_delete is being called further down. The only thing that is needed is to prevent product purchases from being deleted for the cases where user is not being deleted.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedThis seems like a good approach, but the patch file failed testing. Perhaps you need to remove the 'sites/all/modules/' bit from the paths?