• Welcome to Simple Machines Community Forum. Please login or sign up.
October 26, 2021, 01:47:07 AM

News:

Wondering if this will always be free?  See why free is better.


Newsletter to Regular Members

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

Previous topic - Next topic

asmith

March 26, 2014, 09:07:08 AM Last Edit: March 26, 2014, 09:36:17 AM by 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: