I have two newsletters set up. Both are set to "default off" on user registration form.
- When I register for a new account and leave both checkboxes unchecked, I get subscribed to both newsletters.
- When I register for a new account and check one of the checkboxes, I get subscribed to the one I checked.
Digging further, it seems that when the checkboxes are left empty, an empty array of tids is passed in simplenews_user_insert() to simplenews_categories_load_multiple(). That defaults in returning all newsletters and thus the new user gets subscribed to them all.
Comments
Comment #1
Sborsody commentedneeded to check for an empty array. here's what worked for me.
Comment #2
simon georges commentedI can confirm the bug & that the patch is working.
I'm just wondering if the bug is right there or if we should modify the
simplenews_categories_load_multiple()function.Comment #3
upupax commentedconfirm the issue.
the patch solved the problem.
Comment #4
Sborsody commentedIs simplenews_categories_load_multiple() not supposed to load all newsletters in such a case? I sort of like not hitting the database to do a newsletter load if checkboxes are empty.
Comment #5
simon georges commented@Sborsody, you're right (meaning I'll commit your patch this week-end).
But I don't like the fact that passing an empty array as a condition to
simplenews_categories_load_multiple()returns something ;-)Comment #6
miro_dietikerCommitted.
@Simon: this seems to be common behaviour.