Do you think we should be deleting registrations for a given user if their account is deleted? I was surprised to see that this isn't implemented. Were there specific reasons why?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | user-cancel-1546286-1.patch | 4.97 KB | dpi |
Do you think we should be deleting registrations for a given user if their account is deleted? I was surprised to see that this isn't implemented. Were there specific reasons why?
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | user-cancel-1546286-1.patch | 4.97 KB | dpi |
Comments
Comment #1
dpiRegistration doesn't make a choice about whether content should be deleted, admins do. But your right, content should be deleted if admins make that decision.
Patch implements this, with tests.
Comment #2
mstef commentedHey thanks - nice work. Just saved me some time.. I figured I'd be writing this one..
Why are you mentioning content, rather than users? And why do you think we should keep the registration but set the UID to either NULL or 0? How is that better than deleting the registration?
Comment #3
dpiIts up for debate. If a user is deleted and it did not author a registration, but is rather associated as user_uid. Should the registration be deleted?
I mentioned content because all content (entities owned by the user) are dealt with at once by the admin when they cancel an account. But for Registration, content = registrations.
Comment #4
mstef commentedRight.. there definitely are a few ways to go, I suppose..
Perhaps the best would be an admin setting, sort of like how there is when you cancel an account, asking you what you want to do with the user's registrations?
Comment #5
levelos commentedThanks @dpi, looks good and committed.
Comment #6
zulfierken commentedI am trying to delete registrations programmatically. I tried to use I registration_user_delete but this does not do what I want.
I need to get registration id and delete registration by id. Because this code deletes all registrations added by author. I mean if I added registrations for A person and added registration for myself also; and run your code, it will delete both registration A and my registration.
I used
if (isset($registration_id)) {
db_delete('registration')
->condition('registration_id', $registration_id)
->execute();
}
to delete by registration id. There should be another registration load function to load by entity id, entity type and user id
Comment #7
dpiPlease post a new issue in the future. It is obvious this function deletes a users registrations, it is also a core hook: hook_user_delete.
You should use entity_delete.