nodesman / wp-autoresponder

Email marketing and newsletter plugin for WordPress
40 stars 22 forks source link

Broadcast sent to all subscribers #280

Closed franzibua closed 10 years ago

franzibua commented 10 years ago

I made a new broadcast and wanted to send it only the one of my newsletters. So I selected this newsletter on the top of the broadcast. Then I sent the broadcast, but it was sent to all subscribers. How can I fix it?

speedy200man commented 10 years ago

I have the same issue here! Any fix for this ? Pleeease :D

speedy200man commented 10 years ago

Hi guys! I made a fix for this issue.

Step 1: In the source code of newmail.php please replace the line 24 with $recipients = (!empty($_POST['recipients']))?$_POST['recipients']:$nid;

The default behavior is to populate the column in the database with the value from this field. However, the javascript library / function is doing nothing, hence the first issue related to the code.

Step 2:

In the source of processes/broadcast_processor.php, the query used to filter the recipients is not correct. so, on line 34 you should replace the old query with the new one

$getSubscribersForBroadcastQuery = sprintf( "SELECT subscribers.* FROM {$wpdb->prefix}wpr_subscribers as subscribers LEFT JOIN {$wpdb->prefix}wpr_newsletters as newsletters on (newsletters.id=subscribers.fid) WHERE 1 AND subscribers.active=1 AND subscribers.confirmed=1 AND subscribers.fid='".$nid."' " );

This will take in account only the subscribers that enrolled to the specified newsletter in the broadcast record.

Hope this helps and thank you again for this plugin! Cezar

nodesman commented 10 years ago

Fixed in v5.3.10. Please upgrade and all should be fine.