Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2011 at 14:23 UTC
Updated:
7 Jun 2011 at 14:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
vvvi commentedsubscribe
Comment #2
siegoboy commentedHi
I have the same problem and I am not sure what do you mean by subscribe?
Is there a solution to this?
Thank You,
Siegfried
Comment #3
joachim commentedLooks like we're missing an implementation of hook_user_delete().
The fix for this would be pretty simple, if anyone wants to work on a patch. Just move the body of profile2_user_cancel() to a new function, and have both profile2_user_cancel() and hook_user_delete() call that.
Comment #4
siegoboy commentedThanks for the reply!
Wow that sounds simple enough.
My Druple knowledge is very limited, but it would be great if someone could implement this hook.
Comment #5
joachim commented> My Druple knowledge is very limited
It would be a great opportunity to get stuck in and learn more :D
Start at http://drupal.org/patch for instructions on how to make a patch...
Comment #6
siegoboy commentedCool!
I will do!
Thanks!
Comment #7
Countzero commentedHere is a simple-quickly-tested patch following Joachim's advice. Should apply to beta2.
Comment #8
joachim commentedThanks for the patch. Looks good!
Just a few things to tidy up and we're there :)
Be careful with your indentation -- just two spaces.
There's a stray space at the end of this line.
It's good practice to namespace all functions. So this should be called profile2_delete_all_by_user, probably.
Powered by Dreditor.
Comment #9
Countzero commentedShould be good now.
Comment #10
Countzero commentedCarrier return still there in previous version. Should have been deleted.
Comment #11
joachim commentedNearly there! :)
Need a full stop at the end of the comment, and the two lines that start with a * need one space in, so the comment block is like this:
Powered by Dreditor.
Comment #12
Countzero commentedMy ...
Comment #13
Countzero commentedCarrier return back in last version. Sorry.
Comment #14
Jerome F commentedI marked my own issue as duplicate when I found this one.
(I've provided as much details as I could there: http://drupal.org/node/1135744)
Comment #15
Countzero commentedShouldn't this issue be in status 'needs review' ?
Comment #16
Jerome F commentedPatch in #14 solves the problem. When a user is deleted, the profile table is updated accordingly.
Thank you Countzero and joachim
(@siegoboy: Drupal community is raising funds to kill the subscribe comments : http://drupal.org/node/34496 - http://3281d.com/2009/03/27/death-to-subscribe-comments)
Comment #17
joachim commentedWill commit with minor tweaks when I get the chance:
> + // Delete all profiles of the user in any case.
That can go.
> + * Deletes profile information for a canceled or deleted user
Needs a full stop.
Comment #18
joachim commentedAlso moved the new function to a more logical place in the code.
Committed this patch.
Comment #19
dave reidBTW, there's no need to implement both hook_user_delete() and hook_user_cancel(). Only hook_user_delete() should be necessary as that's the one that's executed when data is removed. A user could cancel their own account to have it un-blocked later, so their profile shouldn't probably be deleted in that case.
Comment #20
joachim commentedOh, so what we should have done with this patch was *change* hook_user_cancel to hook_user_delete... :/
Comment #21
jide commentedI think the best thing to do here would be to delete user profile when :
In both cases data is lost.
Patch attached.
Comment #22
ericbroder commented#1065860-2: Profile data not deleted when user account is deleted
Siegfried, the purpose of saying "subscribe" is usually to just simply comment on the current issue so that you can more easily follow issue updates.
Comment #23
ericbroder commentedThis is just a cleaner version of the patch in #1065860-21: Profile data not deleted when user account is deleted.
Summary of expected result based on cancellation option:
- Disable the account and keep its content: leave profile data alone.
- Disable the account and unpublish its content: leave profile data alone.
- Delete the account and make its content belong to the Anonymous user: remove profile data using hook_user_cancel.
- Delete the account and its content: remove profile data using hook_user_delete.
It appears that hook_user_delete is not actually called for the option "Delete the account and make its content belong to the Anonymous user", that actually calls hook_user_cancel with method user_cancel_reassign.
UPDATE: This seems to be incorrect: ...hook_user_delete is not actually called for the option "Delete the account and make its content belong to the Anonymous user". See #1065860-25: Profile data not deleted when user account is deleted.
Comment #24
joachim commented> It appears that hook_user_delete is not actually called for the option "Delete the account and make its content belong to the Anonymous user", that actually calls hook_user_cancel with method user_cancel_reassign.
Looks like the docs for a few of the functions in user module could do with patches...
Comment #25
dave reidCheck out http://api.drupal.org/api/drupal/modules--user--user.module/function/_us...
user_delete() calls hook_user_delete(), so yes it is called for the user_cancel_reassign action. :)
Comment #26
ericbroder commentedThanks Dave Reid, I think you're right, I cannot reproduce my own results that I stated above.
Here's a new patch based on #1065860-20: Profile data not deleted when user account is deleted.
Comment #27
fagoyep, just using hook_user_delete() should be fine. Committed, thanks.