It comes up many times in projects that the user profile form elements need shifted around according to design specifications. pm_email_notify.module defines an option for the user to choose if they want an email notification or not when they receive a PM. However, the way that it is included currently does not make it easy for a site builder to move this around as desired.
For instance, if I create a new profile category, and alter the 'account' category to not show this form field, then alter the new profile category to show this form field, the submit case within pm_email_notify's hook_user() implementation is still executed when I hit submit from the 'account' category. And since the field doesn't exist, it ends up setting turning off the option.
A simple resolution to this is to just do a simple check to make sure that this field even exists within that submit case.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | check_actual_fields_not_category.patch | 1.74 KB | berdir |
| #1 | pm_email_notify-user_submit_check.patch | 1.89 KB | sirkitree |
| pm_email_notify-user_submit_check.patch | 2.79 KB | sirkitree |
Comments
Comment #1
sirkitree commentedSorry, had a little cruft at the top of that patch.
Comment #2
berdirCan't you just extend the existing check? (&& isset($edit['pm_send_notifications'])) Then you only need to change a single line.
Because your patch would still trigger an E_NOTICE as it does always access $edit['pm_send_notifications'] even if it does not exist.
I recently opened the same issue but there is no patch yet, so I'll close that one as a duplicate.
Comment #3
berdirActually, if is moved to a *different* category, then we can replace the $category == 'account' check with what I suggested above.
Comment #4
sirkitree commentedTotally makes sense.
I'm not working off of 2.x-dev locally (1.2 actually), so i don't expect the automated testing to apply - but it should apply with an offset as it doesn't look like this has changed.
Comment #5
berdirAttaching a patch for 2.x that also removes the category check for the (2.x only feature) enable privatemsg setting.
Comment #6
berdirCommited to all branches, thanks for reporting.