Hi,
When testing Simplenews on Drupal 7, I get the following error(s):
Notice: Undefined index: simplenews_subscriber in simplenews_build_unsubscribe_mail() (line 722 of /var/www/html/sites/all/modules/simplenews/includes/simplenews.mail.inc).
Notice: Trying to get property of non-object in simplenews_build_unsubscribe_mail() (line 722 of /var/www/html/sites/all/modules/simplenews/includes/simplenews.mail.inc).
After these errors an 'already subscribed' email is sent.
Here is my path to this error:
1. Subscribe an anonymous user to the newsletter using the Simplenews block form.
2. I received the subscription confirmation mail just fine.
3. Confirmed the subscription using the confirmation link in the email.
4. Logged in as Admin to check wether or not the email address gets added to the list of subscribers to the specific newsletter. This turned out to be Ok.
5. Logged out as Admin.
6. Went to /newsletter/subscriptions.
7. Checked the newsletter (in this case the only one present) for which I wanted to unsubscribe.
8. Filled in the email address I entered at step 1.
9. Clicked the 'unsubscribe' button.
10. Received the above mentioned errors and a message saying: "You will receive a confirmation e-mail shortly containing further instructions on how to cancel your subscription."
11. The email I received was the 'already subscribed' mail.
I dumped the variables passed to the simplenews_build_unsubscribe mail() function:
array (
'from' =>
array (
'address' => 'info@example.nl',
'formatted' => '"example" <info@example.nl>',
),
'context' =>
array (
'category' =>
stdClass::__set_state(array(
'tid' => '23',
'format' => 'plain',
'priority' => '0',
'receipt' => '0',
'from_name' => 'example',
'email_subject' => '[[simplenews-category:name]] [node:title]',
'from_address' => 'info@example.nl',
'hyperlinks' => '1',
'new_account' => 'none',
'opt_inout' => 'double',
'block' => '1',
'name' => 'example nieuwsbrief',
'description' => 'example newsletter categories.',
'weight' => '0',
'vid' => '7',
)),
'account' =>
stdClass::__set_state(array(
'snid' => '3',
'activated' => '1',
'mail' => 'svanderwerf@example.com',
'uid' => '0',
'language' => 'nl',
'timestamp' => '0',
'name' => '',
'tids' =>
array (
23 => '23',
),
'newsletter_subscription' =>
array (
23 =>
stdClass::__set_state(array(
'snid' => '3',
'tid' => '23',
'status' => '1',
'timestamp' => '1326225782',
'source' => 'website',
)),
),
)),
),
)
(I changed the name of the website and the addressee in the text above).
Hope this helps anyone working on the project. Keep up the good work!
Grtz,
Stevan
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | fix_unsubscribe_mails.patch | 3.74 KB | berdir |
Comments
Comment #1
svanderwerf commentedWoops, forgot to mention: I altered the code to dump the contents of the parameters passed to the function. That's why the error is reporting line 722 as the culprit (it actually is is line 721).
Comment #2
berdirThanks for the detailed report!
Should probably simply check 'account' instead of 'simplenews_subscriber' although I need to check if the provided argument is wrongly named or the reference to it?
Comment #3
berdirConfirmed, the attached should fix this and also contains tests, looks like we didn't have test coverage for the unsubscribe mail before.
Comment #5
berdir#3: fix_unsubscribe_mails.patch queued for re-testing.
Comment #6
berdirChanging to 7.x-1.x-dev.
Comment #7
berdir#3: fix_unsubscribe_mails.patch queued for re-testing.
Comment #8
berdirCommited.