HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Modify EmailDiscussion addon to exclude certain users from receiving the emails?

Hi:

Presently the EmailDiscussion plugin sends out emails to all users by default. I want to modify it to exclude certain users from receiving the emails. So, I will modify the body of the email with verbiage like "To unsubscribe from these emails, reply with REMOVE in the subject line." Then, if a user replies asking to be removed, I want to update the EmailDiscussion plugin, perhaps updating config.php directly, to exclude that user/email address.

I'm running 2.1.11.

Anyone willing to modify it for me for a fee?

Thank you.

Tagged:

Comments

  • peregrineperegrine MVP
    edited October 2015

    you could do this...

    -option A

    change line 70 in EMailDiscussion/default.php

    foreach($Emails as $Email) {

    to

       // retrieve excluded email addresses from config.php
        $ExcludeUsers = C('Plugins.EmailSubscribe.ExcludeList'); 
      // take out the excluded addresses from Email Arrray
        $Emails = array_diff($Emails, $ExcludeUsers);  
    // loop through array 
       foreach($Emails as $Email) {
    

    then add excluded email addresses to your config.php

    $Configuration['Plugins']['EmailSubscribe']['ExcludeList'] =  array("joe@none.com","Bozo@none.com","papa@none.com");
    

    • option B

    or you could just edit the default.php of plugin (without a config statement)

    change line 70 in EMailDiscussion/default.php

    foreach($Emails as $Email) {

    to

    // add your list of excluded email addresses here instead of config.
    $ExcludeUsers = array(
    "joe@none.com",
    "Bozo@none.com";
    "the_next_email@address.com",
    "and_next_one@example.com",
    "and_so_on.com@none.com"
    );
    
      // take out the excluded addresses from Email Arrray
     $Emails = array_diff($Emails, $ExcludeUsers);
    
    // loop through array 
      foreach($Emails as $Email) {
    

    you could also have someone write you a setup screen so you could add exluded email addresses via dashboard.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Hi @peregrine

    I've implemented this code. Can't thank you enough!

    Cheers!

Sign In or Register to comment.