one more issue for you, Soren.
if the user was deleted, it's impossible to delete its role applications.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | orphaned_application_fix-240695-13.patch | 906 bytes | jnicola |
| #4 | apply_for_role_240695.patch | 1.11 KB | drewish |
one more issue for you, Soren.
if the user was deleted, it's impossible to delete its role applications.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | orphaned_application_fix-240695-13.patch | 906 bytes | jnicola |
| #4 | apply_for_role_240695.patch | 1.11 KB | drewish |
Comments
Comment #1
Soren Jones commentedVitalie,
Thank you!
Comment #2
Soren Jones commentedI don't have much time now. This should take care of the problem in the future. It doesn't deal with the orphans, now. If you have access to your database, you can delete them by hand. I'll try to get around to an orphan function later this week.
Thanks, again!
Comment #3
Soren Jones commentedFixed in 5 and 6 -dev. But I'm leaving this as active as a reminder to myself until there's also a fix for orphaned applications.
Comment #4
drewish commentedthis should do the trick for D6. you might want to bump the update number down to 5000 something so you can also commit it to the D5 branch and avoid having it run multiple times... thought it wouldn't really matter.
Comment #5
vv7 commentedComment #7
Soren Jones commentedSince I haven't thought of anything better and it was a waste not to use this in the first place...applying to the next release.
Comment #8
Soren Jones commentedThis was fixed in 6 in commit #108507 and in 5 in commit #108516. The issue is that there isn't currently a way to identify and delete orphaned applications. As the bug has been fixed, I'm changing this to a task. We shouldn't ever run into this problem again, but a) we should have a test for it and b) we should check for orphaned applications and delete them.
Comment #9
jnicola commentedHmmm...
Makes sense that this could be a bug.
Two possible ways of handling:
1- Check user is active on view rendering of application. If they don't exist, delete application
2- Create a cron job that reviews all applications for the user being active and not blocked. If they're deleted and/or blocked, delete application.
Comment #10
jnicola commentedOh I just got a better idea...
I can jump on hook_entity_delete() and simply find all applications for a deleted user, and delete the applications.
This would be a nice and easy task for somebody. It would also be beneficial to break the deleting application part out into it's own function for possible usage elsewhere in the module.
Comment #11
jnicola commentedComment #12
alexvn30 commentedthanks, again
more..
Comment #13
jnicola commentedOkay! I fixed this as I wrote above... but it needs testing!
First off, I pushed the hook_entity_delete aspect straight to the dev branch. Makes total sense to have this in there! A user gets deleted, delete their role applications as well! This functionality works, and is ultra straight forward!
Secondly, I recognize this leaves users who have the problem listed above without help... so I wrote an update script that should find all orphaned applications and delete them... SHOULD being the operative term. I am also rusty at writing SQL so it's definitely not the best query ever.
I've attached a patch. Give it a go, and let me know if it works!