When I tried to delete a user I got the following error

Fatal error: Call to undefined function commerce_coupon_load_by_user() in /sites/all/modules/commerce_coupon/commerce_coupon.module on line 674

Comments

mr.baileys’s picture

Status: Active » Needs review
StatusFileSize
new1.54 KB

I've seen the same error when cancelling a user account, except when selecting the "Delete the account and its content." method, since this does not invoke hook_user_cancel().

Since currently coupons cannot be linked to users, I don't think there is any use in implementing the missing commerce_coupon_load_by_user() method. I do think that we can perform some clean-up in the commerce_coupon_log when accounts are cancelled. Attached is a patch that fixes the missing function call (by removing it) and re-assigns coupon log entries to the anonymous user when an account is cancelled using the "Delete the account and make its content belong to the anonymous user."-method.

I don't think we should take any action for "Disable the account and unpublish its content." and "Disable the account and keep its content.", since we can keep referencing the user even when blocked.

In case of "Delete the account and its content.", we might want to reassign the coupon log records to anonymous too? In any case, I guess we need to avoid actually deleting coupon log records, even if a user is deleted together with all his/her content?

webmasterkai’s picture

Status: Needs review » Fixed

applied patch

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.