What is GoodNewsUnSubscription?
GoodNewsUnSubscription is a simple Snippet to perform 1-click unsubscriptions by clicking a link in an email.
How to use the Snippet
You need to place the Snippet in the content of the Resource (unsubscribe page) where the user will be sent to via a special link from a newsletter email.
Default properties for the Snippet
The GoodNewsUnSubscription Snippet implements the following properties:
||A Chunk for error output.||<span class="error">[[+error]]</span>|
||A comma-separated list of 'hooks' (Snippets), that will be executed before the user is unsubscribed.|
||A comma-separated list of 'hooks' (Snippets), that will be executed after the user is unsubscribed.|
||Whether or not to redirect a Subscriber to the unauthorized page if his authentication is not verified.||0 = false|
||The name of the form submit button that triggers the submission.||goodnews-unsubscribe-btn|
||The name of the key submitted as url param in case of success.||unsubsuccess|
||Whether or not to completely remove all user data from database after unsubscription.
(This does not remove or deactivate MODX users with MODX user groups assigned or sudo! Those user will only have related GoodNews data removed.)
||The prefix to use for all placeholders set by this snippet.|
An example GoodNewsUnSubscription Snippet call would look like this:
Sample Unsubscription Form
For a sample form for 1-click unsubscription, please have a look at the code below.
<div class="main"> <h2>One-click unsubscription</h2> [[!+error.message:notempty=` <p class="errorMsg">[[!+error.message]]</p> `]] <p> To immediately unsubscribe from our newsletter service please click the <strong>Unsubscribe now</strong> button below. </p> <form id="profileform" class="gon-form" action="[[~[[*id]]]]?sid=[[!+sid]]" method="post"> <p> <button type="submit" role="button" name="goodnews-unsubscribe-btn" value="Unsubscribe" class="button green">Unsubscribe now</button> </p> </form> </div>
You can read about the handling of subscription and activation in the GoodNewsSubscription Snippet documentation.