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.
This is a minor point, but looking through the code it appears that the pm_email_notify table only ever gets updated or inserted. When users are deleted there is no code to delete their corresponding entry in the pm_email_notify table. One solution might be to add a hook user (pm_email_notify_user) function to perform cleanup on $op = 'delete'.
Comment | File | Size | Author |
---|---|---|---|
#16 | privatemsg_cancel_user2.patch | 6.6 KB | Berdir |
#14 | privatemsg_cancel_user.patch | 5.8 KB | Berdir |
#12 | user_delete_stuff2.patch | 6.33 KB | Berdir |
#11 | user_delete_stuff.patch | 4.7 KB | Berdir |
#2 | pm_email_notify.module.patch | 433 bytes | sja1 |
Comments
Comment #1
litwol CreditAttribution: litwol commentedThat's not a bug. its a feature that was not considered oritinally. Good idea. Your approach is good (hook_user $op='delete'). Uplod a patch of work in progress so others can help out.
Comment #2
sja1 CreditAttribution: sja1 commentedHere's a swipe at it...
Comment #3
BerdirLooks good, simple change.
Comment #4
litwol CreditAttribution: litwol commentedPatch looks good but i am setting this back to active for the sakes of the following discussion (Deppends on what we decide i will change this back to RTBC or needs work):
Similar issue to how user deletions are now handled in 7 core, we should consider having similar integration in privatemsg. What exactly do we clean up when user is deleted/disabled/etc.. Do we delete all of the user settings. Do we delete all of the user messages. Do we archive them somehow. Do we add some kind of marker that user is deleted even though he appears in the "from/to" fields. that leads into next problem of if user is deleted then we cant do join on the user table to fetch his user name to appear in the 'from/to' field.
Much to discuss, what do you guys think?
Comment #5
BerdirWell, Drupal 7 contains a proper facility to cancel accounts, and it also allows to configure what to do with the contents of that user so that we can properly hook into that.
Not sure what to do for Drupal 6...
Comment #6
litwol CreditAttribution: litwol commentedMy gut feeling want me to say: Lets have a new admin UI element to allow site admin to chose behavior for user deletions 1) keep the messages/settings/etc.. 2) delete the messages/settings/etc.
However on real usecase side of things it leads me to believe that it makes absolutely no sense to keep messages/settings/etc... in database after user was deleted because we will never be able to fetch necessary information such as user name or make joints on the users table. So it makes me think that we should also perform complete cleanup when user is deleted without giving site administrator an option to cancel this behavior.
Comment #7
sja1 CreditAttribution: sja1 commentedI think it makes more sense to perform cleanup, and leave configurable deletion handling options for a D7 version of the module. Certainly there is no value in retaining user settings anyway for deleted users, the settings provide no useful historical information.
Thinking about this, I am now wondering about a different problem that I'll open in a different issue.
Comment #8
litwol CreditAttribution: litwol commentedSeems we've reached a consensus. Lets make a patch that encompases all aspects of pmsg user content/settings cleanup (not just email notification settings).
Comment #9
sja1 CreditAttribution: sja1 commentedI'm not very familiar with the rest of the module. What else needs to get cleaned up?
Comment #10
litwol CreditAttribution: litwol commentedHave a quick scan through the module and it's feature-set...
I think we also need to clean up the actual messages as well. There could be more.
Comment #11
BerdirI'm in patch writing mood today :)
Comment #12
BerdirUpdates:
- Added the test from #615834: Error if adressed to someone who got deleted since the patch changed and doesn't use them anymore.
- It does now also delete recipient entries that belong to messages written by that user.
Comment #13
BerdirThis has been commited to 6.x-1.x-dev.
Comment #14
BerdirUpdated the patch to D7. This does now use the user_cancel stuff.
It also contains a test when the user is actually deleted.
Comment #15
BerdirComment #16
BerdirIntegrated the bug fix including a test case from #626692: Deleting user causes mysql error.
Comment #17
BerdirCommited against 7.x-1.x-dev.