Tricks

MailPoet Confirmation page: WordPress users, WooCommerce customers lists

If you are using this plugin MailPoet, you might have noticed that by default, if a user confirms their subscription, they get a message:

You have subscribed to: WordPress Users, WooCommerce Customers, Newsletter mailing list

In really big bold heading letters. Believe me, this can be overwhelming to any new user to your site. And they might feel, that you will be sending them too many newsletters. And they might prefer to unsubscribe right then and there.

Best way is to show a simple message like:

Thank You, you are now subscribed to our Mailing List.

To do this, you will need to modify the code a bit. At the time of this post, MailPoet wordpress plugin is v3.85.0

So all line numbers mentioned will correspond to this version. But just search for the text and you will find the code.

Open file:

/wp-content/plugins/mailpoet/lib/Subscription/Pages.php

Look for code:

$title = sprintf(
$this->wp->__("You have subscribed to: %s", 'mailpoet'),
join(', ', $segmentNames)
);

The

%s

in this code will list all the mailing lists.

So, just put something like “Thank You” here:

$title = sprintf(
$this->wp->__("Thank You", 'mailpoet'),
join(', ', $segmentNames)
);

If you also want to change the message:

Yup, we’ve added you to our email list. You’ll hear from us shortly.

Then look for function:

private function getConfirmContent() {
if ($this->isPreview() || $this->subscriber !== null) {
return $this->wp->__("Yup, we've added you to our email list. You'll hear from us shortly.", 'mailpoet');
}
}

And change things here.

Note that if you update, then this code might change. And you might need to make changes again every update.

A better but slightly longer solution is to change all these lines in translation file:

wp-content/plugins/mailpoet/lang/mailpoet.pot

And generate a mo file using wp-cli:

wp glotpress import-originals project-name wp-content/plugins/mailpoet/lang/mailpoet.pot

For other languages, you can also use a tool like poedit. Read more about how to make mo files from your po or pot files:

https://wplang.org/translate-theme-plugin/

Leave a Reply

Your email address will not be published. Required fields are marked *