unsubscribe.naml
<macro name="unsubscribe" requires="servlet">
<n.node_page.>
<n.if.is_submitted_form>
<then>
<n.if.equal value1="remove-subscription" value2="[n.action_parameter/]">
<then>
<n.if.page_node.visitor_is_subscribed>
<then.page_node.visitor_subscription.remove/>
</n.if.page_node.visitor_is_subscribed>
<n.redirect_to.subscription_removed_url/>
</then>
</n.if.equal>
</then>
</n.if.is_submitted_form>
<n.html>
<head>
<meta name="robots" content="noindex,nofollow"/>
<n.title.><t>Unsubscribe</t></n.title.>
<n.main_title_css/>
</head>
<body>
<n.visitor.profile_header/>
<div class="shaded-bg-color rounded second-font main-title">
<t>Remove Subscription</t>
</div>
<div style="font-weight:bold;margin: 2em 0 1em">
<t>Do you really want to unsubscribe from <t.location><a href="[n.page_node.url/]"><n.page_node.subject/></a></t.location>?</t>
</div>
<n.unsubscription_form/>
</body>
</n.html>
</n.node_page.>
</macro>
<macro name="unsubscription_form" requires="node_page">
<n.form.>
<input type="hidden" name="node" value="[n.page_node.id/]"/>
<input type="hidden" name="action" value="remove-subscription"/>
<input type="submit" class="toolbar action-button" value="[t]Yes, unsubscribe now[/t]"/>
<t>or</t> <a href="[n.page_node.url/]"><t>Cancel</t></a>
</n.form.>
</macro>
<macro name="subscription_removed" requires="servlet">
<n.node_page.>
<n.subscription_msg
header="[t]Subscription Removed[/t]"
message="[t]Your subscription to [t.location.page_node.subject/] has been successfully removed.[/t]"
/>
</n.node_page.>
</macro>
<macro name="subscription_removed_url">
<n.remove_spaces.>
<n.page_node.base_url/>
/template/NamlServlet.jtp?macro=subscription_removed&node=<n.page_node.id/>
</n.remove_spaces.>
</macro>
<macro name="unsubscribe_by_code_url" requires="subscription">
<n.remove_spaces.>
<n.base_url/>
<n.encode_url.>
/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=<n.node.id/>&code=<n.subscription_code/>
</n.encode_url.>
</n.remove_spaces.>
</macro>
<!--
Unsubscribe by code has a confirmation step to prevent crawlers from unsubscribing users without intention.
-->
<macro name="unsubscribe_by_code" requires="servlet">
<n.node_page.>
<n.catch_exception. id="remove-subscription">
<n.page_node.get_subscription_by_code. code="[n.code_parameter/]">
<n.if.not.is_subscribed>
<then.throw_template_exception name="not_subscribed"/>
</n.if.not.is_subscribed>
<n.if.is_submitted_form>
<then>
<n.remove/>
<n.send_unsubscription_reminder/>
</then>
</n.if.is_submitted_form>
</n.page_node.get_subscription_by_code.>
</n.catch_exception.>
<n.html>
<head>
<meta name="robots" content="noindex,nofollow"/>
<n.title.><t>Remove Subscription</t></n.title.>
</head>
<body>
<n.edit_header first_text="[n.page_node.subject/]" second_text="[t]Remove Subscription[/t]" />
<n.if.has_exception for="remove-subscription">
<then.handle_unsubscription_by_code_errors/>
<else>
<n.if.is_submitted_form>
<then>
<h2><t>Subscription Removed</t></h2>
<t>Your subscription to <t.location.page_node.subject/> has been successfully removed.</t>
</then>
<else>
<h2><t>Do you really want to unsubscribe from <t.location><a href="[n.page_node.url/]"><n.page_node.subject/></a></t.location>?</t></h2>
<n.form.>
<input type="hidden" name="code" value="[n.code_parameter/]"/>
<input type="hidden" name="action" value="remove-subscription"/>
<input type="submit" class="toolbar action-button" value="[t]Yes, unsubscribe now[/t]"/>
<t>or</t> <a href="[n.page_node.url/]"><t>Cancel</t></a>
</n.form.>
</else>
</n.if.is_submitted_form>
</else>
</n.if.has_exception>
</body>
</n.html>
</n.node_page.>
</macro>
<macro name="handle_unsubscription_by_code_errors">
<n.handle_exception. for="remove-subscription">
<n.exception. name="invalid_link">
<h2><t>Invalid Code</t></h2>
<t>The code in the URL is not valid.</t>
<t>Please contact Nabble Support if you need help.</t>
</n.exception.>
<n.exception. name="not_subscribed">
<h2><t>You're not a subscriber</t></h2>
<t>You are not subscribed to <t.location.page_node.subject/>.</t>
</n.exception.>
</n.handle_exception.>
</macro>
<macro name="send_unsubscription_reminder" requires="subscription,node_page,servlet">
<n.set_local_subscription.this_subscription />
<n.new_email.>
<n.send>
<to><n.user.user_email/></to>
<subject><t>You have been unsubscribed from <t.location.page_node.subject/></t></subject>
<text_part>
<t>Dear user,</t>
<t>Your subscription to <t.location.page_node.subject/> has been removed.
If this was a mistake, you can re-subscribe by following the link below:</t>
<n.local_subscription.subscribe_by_code_url subscription_to="[n.to/]"/>
<t>Sincerely,</t>
<t>The Nabble team</t>
________________________________________
<t>Free Embeddable <t.app.page_node.view_name/></t> powered by Nabble
<n.nabble_homepage/>
</text_part>
<html_part>
<t>Dear user,</t><br/>
<br/>
<t>Your subscription to <t.location.page_node.subject/> has been removed.
If this was a mistake, you can re-subscribe by following the link below:</t><br/>
<n.local_subscription.subscribe_by_code_url subscription_to="[n.to/]"/><br/>
<br/>
<t>Sincerely,</t><br/>
<t>The Nabble team</t><br/>
________________________________________<br/>
<t>Free Embeddable <t.app.page_node.view_name/></t> powered by Nabble<br/>
<n.nabble_homepage/><br/><br/>
</html_part>
</n.send>
</n.new_email.>
</macro>