How to removing Unsubscribe link from email campaign

Hi guys,

Does anyone know how to remove this message from the bottom of email campaigns? We already have an unsubscribe in place.

To remove yourself from this email list click here

Appreciate any help

1 Like

The following method is not upgrade safe but works:

Edit the file modules/EmailMan/EmailMan.php at around line 820 and comment out the following lines:

                //do not add the default remove me link if the campaign has a trackerurl of the opotout link
                if ($this->has_optout_links==false) {
                    $mail->Body .= "<br /><span style='font-size:0.8em'>{$mod_strings['TXT_REMOVE_ME']} <a href='". $this->tracking_url . "index.php?entryPoint=removeme&identifier={$this->target_tracker_key}'>{$mod_strings['TXT_REMOVE_ME_CLICK']}</a></span>";
                }

Alternatively you could add a custom boolean field in the campaigns module and, instead of commenting out that code you could add an if statement that checks your field. In this case you wouldn’t lose the possibility to have the remove me link inserted when no opt out tracker links have been added to the email.

I don’t know whether copying the edited file to custom/modules/EmailMan/EmailMan.php would turn this modification into an upgrade safe modification. You can try. (in case the folder custom/modules/EmailMan does not exist you have to create it manually.)

Please let us know if it works in the custom folder.

2 Likes

Thanks, we commented out the lines above and it worked.

Just come across same issue and found a way to remove the link without changing the code.

Looking at code in more detail I found this in modules/EmailMan/EmailMan.php @ line 747:

$this->tracker_urls=array();
                                while (($row=$this->current_campaign->db->fetchByAssoc($result)) != null) {
                                        $this->tracker_urls['{'.$row['tracker_name'].'}']=$row;
                                        //has the user defined opt-out links for the campaign.
                                        if ($row['is_optout']==1) {
                                                $this->has_optout_links=true;
                                        }
                                }

Which pointed me to the fact that if you add a ‘Tracker URL’ in your campaign with the link text of just ‘.’ and check the ‘Is Opt Out’ checkbox. Then the default unsubscribe is not added (although the new trackerURL is added in its place, but you can’t really see it so its as good as removed in the user’s eyes).

Still a bit of a bodge but at least the next upgrade won’t silently re-enable the default unsubscribe link again.

I’m going to add an issue on GitHub about this as our CRM is not publicly visible so the default unsubscribe ‘feature’ is completely broken from our perspective.

1 Like

Here is the issue on GitHub