jtimana
September 18, 2023, 11:15pm
3
I’m having the same issue. This is the first time I’ve tried to implement it, I’ve followed almost every guide and I’m pretty sure that I’m not missing anything yet I cannot get this custom unsubscribe page to work. I also think this isn’t a very common feature people use so that’s why I don’t see a lot of people complaining about it. However, this seems to be a pretty old issue, see the following posts:
Your software
My Mautic version is: 3.3.3
My PHP version is: 7.4
I can’t seem to be able to setup a custom unsubscribe page. It simply doesn’t work according to the instructions outlined on the Mautic documentation here: Customize preference center | Mautic
I’ve triple checked everything and am missing nothing. The unsubscribe link takes you to the default Mautic page with the line " We are sorry to see you go! email@gmail.com will no longer receive emails from us. If this was by mistake, cl…
Hi All,
I have been working with a client who requires a specific preference center and we have tried everything and it does not seem to be working.
Our Setup:
Create a new landing page and set as preference center.
Create an email and set the preference center as the one in point #1.
Send e-mail with {unsubscribe_url}
Click on unsubscribe link in private browser and separate browser.
Results in standard unsubscribe and not brining up the “preference center”
The only error I see in the log…
Description:
I have created a custom preference page on Unsubscribe link
Created a new theme for the landing page using page.html.twig.
Upload this theme in mautic.
Go to the landing page and select this theme and set it as a preference center page.
Then go to the Emails and from the dropdown in “Preference center page” select this landing page.
Select “YES” for “Show contact preference settings” and “YES” for “Show contact segment preferences” in the Email Setting.
Send an e-mail to a test …
opened 10:04PM - 08 Mar 21 UTC
closed 11:15PM - 03 Nov 21 UTC
T1
bug
landing-pages
stale
[//]: # ( Invisible comment:
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII… I
Before you create the issue:
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
Search for similar report among other reported issues.
Learn how to troubleshoot at https://www.mautic.org/docs/en/tips/troubleshooting.html
Use drag&drop to attach images or other files )
## Bug Description
I setup a custom preference center landing page. It is published with a template in code mode and is in language fr. I send an email where I have assigned this preference center landing page to it. The email is in language fr and is using the template blank. When I click on the unsubscribe link. I see the template of my landing page encapsulated in the `message.html.twig` extends the `base.html.twig` templates of the blank template. Moreover, a custom body and html header tags are added to the template.
The generated HTML :
```html
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" type="text/css" />
<script data-source="mautic">
...
</script>
</head>
<body>
<div>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<body>
my preference center landing page code mode content
</body>
</html>
</body>
</html>
```
I should be able to have a custom template for my custom landing page which is not linked to the template of the email I access the page from and without any modification done by mautic.
| Q | A
| --- | ---
| Mautic version | 3.3.1
| PHP version | 7.3.27
| Browser | Chrome
### Steps to reproduce
1. Setup a custom preference center page with template in code mode
2. Send an email with template blank and the previous preference center page assigned to this email
3. Click on the unsubscribe link in the email
### Log errors
No errors
I have tracked it here :
In [PublicControllerL242](https://github.com/mautic/mautic/blob/37ed5ee87900522c888b09ed3857ad0452fb33df/app/bundles/EmailBundle/Controller/PublicController.php#L242) :
```php
$event = new PageDisplayEvent($html, $prefCenter, $params);
$this->get('event_dispatcher')->dispatch(PageEvents::PAGE_ON_DISPLAY, $event);
$html = $event->getContent();
```
Listeners on this event are modifying the custom code of the preference center landing page. This is not the most troublesome part. It could stay as it is. However, the fact that it reuses the email template when we are in `mautic as code` template mode for the preference center is troublesome :
```php
// here $template is the one from the email from which we clicked on the unsubscribe link.
$contentTemplate = $this->factory->getHelper('theme')->checkForTwigTemplate(':'.$template.':message.html.php');
///...
$viewParams = [
'email' => $email,
'lead' => $lead,
'template' => $template,
'message' => $message,
];
return $this->render($contentTemplate, $viewParams);
```
I can propose a PR if you point me in the correct direction you would like this behavior to be changed/fixed. Maybe something like if custom preference center page is enabled and is a `mautic_as_code` template, override `$contentTemplate` to use a dedicated `empty.html.twig` template which just print `{{ message|raw }}`.
[//]: # ( Invisible comment:
Please check for related errors in the latest log file in [mautic root]/app/log/ and/or the web server's logs and post them here. Be sure to remove sensitive information if applicable. )