Customize email verification for CampaignManager

The way Campaign Manager handles these pages is a bit hard to find: The pages where users are redirected after clicking a link are defined by the mail template.

Create the custom pages

First, you will need to create CMS pages for the messages you want to override. In this example I will talk about the "Verify" page, the one people arrive once they have verified their e-mail address, but you can do the same with the "unsubscribe" page.

For example here's the page I created at [theme_path]/pages/campaign/verify-page.htm (I placed it next to the campaign templates, but you can place it anywhere you want) :

title = "Verify email"
url = "/newsletter-messages/verified"
layout = "classic"
is_hidden = 0

[viewBag]
==
<div class="container">

    <h1>Mail verification</h1>
    <p>Your mail address has been verified successfully</p>

</div>

Note that you can, as in any normal CMS page, use the main layout of your site.

Creating an empty template for the "verification" page

As the verification email is not linked from a Newsletter (contrary to unsubscribe), you may want to create an empty template from which you will be able to configure the custom pages.

To do so, you must create an empty CMS page in which you include the campaignTemplate component. You don't need any content in this page.

As for any Campaign Manager template, the slug of this page must contain a variable named code that will be the unique verification code for a user.

Link the custom pages to your Campaign templates

On each of your campaign template including your empty template, fill the "Links" section of the campaignTemplate component with the custom pages you created before.

Note that for the template you will use in your Newsletters, only "Unsubscribe page" will be used, and for your empty template (if you created one as explained above), only the "Verify page" will be used.

For example, here's how my empty template at [theme_path]/pages/campaign/empty-template.htm looks like :

title = "Newsletter messages"
url = "/newsletter-messages/:code"
is_hidden = 0

[viewBag]

[campaignTemplate]
verifyPage = "campaign/verify-page"
unsubscribePage = "campaign/unsubscribe-page"
==

Link the empty template to the subscribe form

For the "unsubscribe" page, there is no other action required because the new link will be used with the template of your newsletter, but for the "verification" page, you will need to edit each page or layout where you use the campaignSignup component and set the "Confirmation page" in the settings of this component to your empty mail template.

Posted in OctoberCMS on Apr 03, 2017