News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Newsletter to Regular Members

Started by asmith, March 26, 2014, 09:07:08 AM

Previous topic - Next topic

asmith

Hello,

SMF 2.0.7
Trying to use newsletter to only regular members fails.

How to reproduce:
Try sending email or pm to regulars members ONLY. (Admin => newletters)

Reason:
When in the composing mail page (admin, area=news, sa=mailingcompose)
The hidden input for values contains only 0 value which stands for regular members group:

<input type="hidden" name="groups" value="0" />
After clicking to send:
File: Sources/ManageNews.php, line 493:

// Cleaning groups is simple - although deal with both checkbox and commas.
    if (!empty($_POST['groups']))


empty() will return true because the value is 0, while it should consider that group.

Solution:
File: Sources/ManageNews.php, line 493:

Replace: (line 493)
    if (!empty($_POST['groups']))
With:
    if (isset($_POST['groups']) && (is_array($_POST['groups']) && !empty($_POST['groups'])) || (!is_array($_POST['groups']) && trim($_POST['groups']) != ''))
First time visiting newsletter page (selecting recipients page), groups is an array. Second time in compose mail, groups is string.

Advertisement: