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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hkovacs created an issue. See original summary.

hkovacs’s picture

Another idea is to check the method of the hook_user_cancel. I will implement that first and see what you guys think.

hkovacs’s picture

Interesting that I see that you have function ms_products_user_delete further down on line 1773.

hkovacs’s picture

Here 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.

Status: Needs review » Needs work
Anonymous’s picture

This seems like a good approach, but the patch file failed testing. Perhaps you need to remove the 'sites/all/modules/' bit from the paths?