Jump to content

Export only the clients who have opted in for marketing emails


Recommended Posts

  • WHMCS Technical Analyst

You might have noticed that while exporting client list (to import in Mailchimp or any other email marketing tool you might be using), there is no way to filter the client list on the basis of their "Email Optout Status" as there is no filter for this service. As the report php files are not encoded, you can always modify them to suit your needs. Here, I have modified the file `/modules/reports/clients.php` to add the Email Opt Out filter so you can export only the clients who have opted in for marketing emails. 

To do this, just copy the clients.php file and rename it to something like "clients-marketing.php". Then edit the following code on line 8 :

$filterfields = array("id"=>"ID","firstname"=>"First Name","lastname"=>"Last Name","companyname"=>"Company Name","email"=>"Email","address1"=>"Address 1","address2"=>"Address 2","city"=>"City","state"=>"State","postcode"=>"Postcode","country"=>"Country","phonenumber"=>"Phone Number","currency"=>"Currency","groupid"=>"Client Group ID","credit"=>"Credit","datecreated"=>"Creation Date","notes"=>"Notes","status"=>"Status");

 

to

$filterfields = array("id"=>"ID","firstname"=>"First Name","lastname"=>"Last Name","companyname"=>"Company Name","email"=>"Email","address1"=>"Address 1","address2"=>"Address 2","city"=>"City","state"=>"State","postcode"=>"Postcode","country"=>"Country","phonenumber"=>"Phone Number","currency"=>"Currency","groupid"=>"Client Group ID","credit"=>"Credit","datecreated"=>"Creation Date","notes"=>"Notes","status"=>"Status","emailoptout"=>"Email Optout");

 

That is it. Do not forget to update the report title (on line 6) to a title of your liking. Once the changes are saved, you will see a new report on the Reports page with the title you selected on line 6.

custom-report.thumb.JPG.5ec9f008a1eccd37da1741d28291ab56.JPG

Hope it helps.  If required, feel free to customize it as you need. 

Link to comment
Share on other sites

  • WHMCS John featured this topic
  • 11 months later...

Got it:

$filterfields = [
    'id' => 'ID',
    'firstname' => 'First Name',
    'lastname' => 'Last Name',
    'companyname' => 'Company Name',
    'email' => 'Email',
    'address1' => 'Address 1',
    'address2' => 'Address 2',
    'city' => 'City',
    'state' => 'State',
    'postcode' => 'Postcode',
    'country' => 'Country',
    'phonenumber' => 'Phone Number',
    'currency' => 'Currency',
    'groupid' => 'Client Group ID',
    'credit' => 'Credit',
    'datecreated' => 'Creation Date',
    'notes' => 'Notes',
    'status' => 'Status',
    'emailoptout'=>'Email Optout',
    'marketing_emails_opt_in'=>'Email OptIN'
];

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated