The My subscription page (in which og2list uses hook_form_alter to modify og's subscription settings) needs updating for Drupal 5.x og. og2list does not support the new og_uid_global table properly in mail-out.pl. While 2 seperate issues these are intertwined and so I've addressed them in one patch... I found and fixed them together.
Several problems are evident:
- og2list keeps removing the Submit button off the my subscription page, if the user is set to never/always receive notifications.
- if the group does not have a mailing list yet, og2list will remove the whole form and instead say:
Mail address: n/a No mailing list has been created for this group.
What should happen instead:
- og2list should match its output to what og is doing. If you are set to Always or Never in og_uid_global, it should display that along with a link to manage your subscription (just like og does);.
- Otherwise you should be able to always press submit when the radio buttons are present.
- When mail-out.pl is choosing recipients with the $get_create_mail_stmt, it must properly respect the og_uid_global settings as well.
The attached patch fixes the manage subscription page to use og_uid_global and display the same output as og when the user's subscription is set to Always or Never send notifications.
in mail-out.pl, the query properly respects these settings. Never and Always in your "my account" override alwyas. If you are set to selective then it depends on what you have in your my subscription, and you can get digests.
Finally, I also added in one other enhancement I have in my version where it displays the proper from address to send to the list from. This helps users get the email address correct when sending. This email address is printed in both the my subscription page and the Mailing list tab - both are included in the patch. I also included a more detailed description for the Mailing List tab.
Hopefully that is not too much jammed into one patch, but it was sort of all related to this one fix.
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | og2list_manage_subscription_fixes_2.patch | 5.9 KB | damien_vancouver |
| #3 | o_1.patch | 448 bytes | miglius |
| #1 | og2list_manage_subscription_fixes_0.patch | 5.92 KB | damien_vancouver |
| og2list_manage_subscription_fixes.patch | 5.81 KB | damien_vancouver |
Comments
Comment #1
damien_vancouver commentedUsers who have values of NULL in their og_uid.mail_type field will be defaulting to not getting emails (web only).
The previous patch incorrectly displayed "individual mail" selected on the form for these users, when it should default to web only so they have to choose individual messages or digest and turn it on.
attached _0 patch is updated to reflect this.
Comment #2
miglius commentedAfter applying the latest patch to og2list I haven't checked the functionality yet, but I have noticed that subscription interface in group context prints "Submit" button in all the cases - when the user's notifications are set to Never, Always and Selectively.
I think that the Submit button should be visible only when user selectively chooses notification and radio buttons are available for the choice in the group context.
When user has set his notification to Never or Always it is unclear what Submit button does in the group context, since there is no radio buttons there, just a link to user's edit page.
Comment #3
miglius commentedAttached is a patch which removes Submit button when it is unneeded.
Comment #4
damien_vancouver commentedI think the submit button has to be printed because otherwise it vanishes for groups that don't have mailing lists set.
The problematic part is that og2list is doing this form altering on og subscription form. Instead of just changing things, og2list is removing the submit button from, and it was happening for groups without mailing lists enabled. If you enable og2list on a site with lots of existing groups then suddenly no one can manage their subscription settings.
Anyway it's been a while, I will have to look at it in the HEAD version again.. I found a fairly compelling reason not to have the submit button printed and I think that was it.
You should try making a group without a list and then checking my subscription, see if you can still modify them. I'll be getting a HEAD version up for testing in the next little bit, and I'll review it again as well. If the current group has a mailing list I guess we could keep removing that submit button, as long as it doesn't affect other groups. The user is actually submitting a form, it just contains the one hidden form element. Maybe other modules might want to inject or alter the form and add/remove stuff too? That is another argument for keeping the submit.
Comment #5
miglius commentedWith the og2list module disabled, og module prints the Submit button in group's "My subscriptions" page only when notifications are set to "Selectively send email notification based on the checkbox for each of my group's My Subscription page". When notification is set to "Never send email notification" or "Always send email notifications" og module doesn't print Submit button, but prints a link to user's edit page instead.
I think that og2list should follow og behavior and shouldn't print submit button when user sets notification to always or never.
Comment #6
damien_vancouver commentedYes it works with the module disabled but what about when the module is enabled, for groups without a mailing list?
try this:
1. disable og2list
2. Create a new group.
3. subscribe to notifications for it - note the appearance of the subscription page
4. Now re-enable og2list in admin/build/modules
5. go to the group you created (without a mailing list) and back to your my subscription page
see if is showing the submit button. If the submit button is blocked, but the group doesn't have a list, then that's a bug.. I think this is the behaviour I was seeing.
I don't think og2list should be touching og's form at all... at least definitely not for groups that don't have a recipient set in thier edit form (ie non og2list groups but with og2list enabled).
Comment #7
miglius commentedI don't see the behavior you've described. For me it just worked as expected (with your and my patches applied) :
1. disabled og2list
2. Created a new group.
3. subscribed to notifications for it
4. Re-enabled og2list in admin/build/modules
5. went to the group I created (without a mailing list) and back to my my subscription page.
I see the og radio buttons to chose whenever I want to subscribe or not to the notifications and a Submit button. Submit button is not blocked as when there is no mailing list address, the og form is not overwritten.
Comment #8
damien_vancouver commentedI have created a public test environment for og2list HEAD current issues - please see http://groups.drupal.org/node/9392 for more info on the test instances.
This is the first patch that we will be testing. The patch is not applied to http://og2list-b4.postcarbon.org (that version is HEAD).
The patch IS applied to http://og2list-after.postcarbon.org (that is HEAD http://drupal.org/files/issues/og2list_manage_subscription_fixes_0.patch from #1 on this issue)
We are verifying two main problems/fixes here.
1. Register on http://og2list-b4.postcarbon.org.
2. Visit and subscribe to these two test groups:
testgroup-b4 (og2list group) http://og2list-b4.postcarbon.org/testgroup-b4
non-og2list (non og2list group) http://og2list-b4.postcarbon.org/non-og2list
3. Go into "My Account" on og2list-b4 and set Organic Groups -> Notification Settings to be:
Selectively send email notification based on the checkbox for each of my group's My Subscription page
4. Log in to http://og2list-after.postcarbon.org with the same username and password from Step 1 (we use LDAP integration to join all our site logins together).
5. Join the two corresponding test groups on og2list-after:
testgroup-after (og2list group) http://og2list-after.postcarbon.org/testgroup-after
non-og2list (non og2list group) http://og2list-after.postcarbon.org/non-og2list
6. Go into "My Account" on og2list-after and set Organic Groups -> Notification Settings to be:
Selectively send email notification based on the checkbox for each of my group's My Subscription page
7. Now see how the My Subscription behaves differently in an og2list group when set to selective notifications
- on og2list-b4, go into testgroup-b4 and choose "my subscription" on the right.
The options will appear but there is no way to submit them! og2list is removing the Submit button!
- on og2list-after, the submit button is there and the form works as expected.
8. See how My Subscription behaves differently when set to always or never receive notifications:
- go into my account, and set Organic Groups Settings -> Email Notification to "Always receive notifications"
- Now go to og2list-b4 and choose "My subscription". Event hough you are set to always receive notifications, you will see the three options. But there is no submit button! og2list should be saying you are set to always and showing a link to the profile page.
- On og2list-after, set yourself to Always Receive Notifications in my account and then go to og2list-after and hit "My subscription". You should see a message that you are set to always accept notifications, a link to your profile page, and no submit button.
7. See how My Subscription behaves differently for a non-og2list group
- on og2list-b4, go into "non-og2list' group and choose "my subscription". You will see that instead of the og subscription options, og2list is replacing the form with:
Mail address: n/a
No mailing list has been created for this group.
This makes no sense, as the group should show normal options if it's not configured for a mailing list, not remove the og options and print that!
- on og2list-after, go into "non-og2list" and choose "My Subscription" on the right. You will see the normal og subscription options.
Please test along and verify this is indeed broken on og2list-b4 and working on og2list-after!
8. The mail-out improvements make the Always / Never settings in og_uid_global correctly override these settings. You can test that too:
- Create a second account on the og2list-b4 site with an e-mail you'll receive
- Sign up to testgroup-b4
- Hit "My account" and set yourself to always receive notifications
- Repeat the process on testgroup-after - log in with the 2nd account (using LDAP), sign up to testgroup-after, and then go into My Account and set yourself to always receive notifications.
- Now log out of both sites and log in with the original usernames (also subscribed to the testgroups)
- Use og2list to e-mail in, or the group menu on the right to create new content in the two test groups.
- In og2list-b4, you should not receive an og2list mail. mail-out.pl won't properly see your new user and its og_uid_global setting
- in og2list-after, you should receive an og2list mail, becuase mail-out.pl sees the og_uid_global row.
- Note that on both test sites, you should receive double notifications - og and og2list. This is because http://drupal.org/node/165299 is not yet applied (we are going to work on testing that one next)
9. Test that "My subscription" on og2list-after shows the mail address your mail has to come from.
It should look like this:
From-Address for messages: user@example.com
You must use the e-mail address shown here to send messages. If your e-mails to the list bounce, make sure you are sending them from this address!
Please let me know here or at http://groups.drupal.org/node/9392 if you find any problems with the test environments. And if you do help test, please comment back here so your testing is recorded (that will greatly help get the patches reviewed and ready for CVS).
Comment #9
damien_vancouver commentedOK, some problems were found testing the last patch.
A couple of the changes weren't applied becuase it was for 1.106 and head is 1.109.
I re-rolled it to the right version. I also got a testing report back that og2list was incorrectly showing the submit button when it shouldn't, as reported and patched by miglius in #3.
It turns out if you are an admin, you see the subscription options in HEAD when you shouldn't, and then no submit is shown. This is the behavior I was originally noticing because I was using an admin user. For regular users, the The correct behaviour is as with #3 patched, so admins also get the message that they are set to always or never and a link to their profile page.
For regular users, the bug was as follows:
- when set to always or never in my account, regular users would see the 3 options and no submit button.
- Instead it should behave the same as og and print that they were set to always or never and have the link.
I updated the testing instructions at #8 so they properly reflect as it will look for regular users. I also verified that the forms are working correctly with an admin user, and applied the new version of the patch to og2list-after.
If someone can go through the test instructions again (#8) and comment back that would be helpful!
Comment #10
Saganesque commentedWhen I attempt to apply the patch, I'm getting the following error with the ...fixes_0.patch (and the _2.patch):
"Hunk #1 FAILED at 252."
Any idea what might be causing this? I'm new to patching.
Comment #11
Saganesque commentedbump
Comment #12
Saganesque commentedActually when I start from scratch, the _0 patch takes, but none of the subsequent patch revisions do, even if I start from scratch and try to apply the _2 version of the patch. Any suggestions?
Comment #13
Saganesque commentedWell, I thought the _0 patch took. After starting over completely, it didn't. None of them do. I always get an error when I try to apply any version of the patch.
This is too bad. There are few viable options for getting listserv or Yahoo-like capability from Drupal. This solution looked like it would work, but it isn't an option in Drupal 5.