Customize your confirmation and unsubscribe pages

MailPoet adds a custom post type on your site that is used to show the subscription Confirmation page and the Unsubscribe page.

However in most cases, this custom post type will inherit the post template and will show undesired sections from your theme, like comments, trackback, social share icons, etc.

To change this behavior, you need to create two new specific pages for each of these two actions (Confirmation page and Unsubscribe page).

We are aware that some people don't like the " Great, you'll never hear from us again!" or "Yup, we've added you to our list. You'll hear from us shortly." so we'll show you how to change them:

Steps to customize your pages

1. Go to your Pages menu inside your WordPress Dashboard and click on "Add New":

2. First, let's create a page for the Unsubscribe page:

Tip: Read more about Page Templates.

3. Second, repeat the same steps to create another new page for the Confirmation page:

4. Go to MailPoet's Settings page. On the Basics tab you'll select the new Unsubscribe page that you have just created.

You can click on Preview to see what it's going to look like with your theme's page template from your theme. Save your settings.

Here's the preview of that page. Notice that we intentionally left the comments section in so that we can show you how to remove it:

Here's how to remove the comments section:

Here's how it looks like now, without the comments section:

5. Inside your Settings page (under the MailPoet menu), go to the Signup Confirmation tab and change the page that will show up when your subscribers click on the link to confirm their subscriptions.

Don't forget to Save your settings.

And here's the new Confirmation page:

6. Now we are going to do the same for the "Edit your profile" link that goes on your newsletter footer:

Then, assign this new page on the Settings:

And voilà:

7. Bonus! If you have a sharp eye, you have probably thought: "Okay, but the old Unsubscribe page contained an Undo Unsubscribe link, how can I add it to this new Unsubscribe page?"

Here's how to do it: add the following code to the bottom of your current theme's  functions.php file (wp-content/themes/your-theme/).

/**
 * function to return an undo unsbscribe string for MailPoet newsletters
 * you could place it in the functions.php of your theme
 * @return string
 */
function mpoet_get_undo_unsubscribe(){
	if(class_exists('WYSIJA') && !empty($_REQUEST['wysija-key'])){
		$undo_paramsurl = array(
		 'wysija-page'=>1,
		 'controller'=>'confirm',
		 'action'=>'undounsubscribe',
		 'wysija-key'=>$_REQUEST['wysija-key']
	 	);

		$model_config = WYSIJA::get('config','model');
        	$link_undo_unsubscribe = WYSIJA::get_permalink($model_config->getValue('confirmation_page'),$undo_paramsurl);
		$undo_unsubscribe = str_replace(array('[link]','[/link]'), array('<a href="'.$link_undo_unsubscribe.'">','</a>'),'<strong>'.__('You made a mistake? [link]Undo unsubscribe[/link].',WYSIJA)).'</strong>';
		return $undo_unsubscribe;
	 }
	return '';
}

add_shortcode('mailpoet_undo_unsubscribe', 'mpoet_get_undo_unsubscribe');

Then add this shortcode to your newly created Unsubscribe page: [mailpoet_undo_unsubscribe]

Tip: If you are using a custom  Page Template you can "echo" the Undo link directly into your .php template:

echo mpoet_get_undo_unsubscribe();

Here's what it's going to look like now: