Skip to the content
Documentation

Adding a "Keep me updated" button

No ratings yet

A "Keep me updated" button lets a signed-in visitor follow a page from the public site. It posts to content/action, which sends the visitor to notification/addtonotification/<node id>. That page asks once more; only its Notify me button subscribes, so following a link never subscribes anyone by itself.

The button

Add a form like this to the full view template of the class (for example an override of node/view/full.tpl for folders):

{if fetch( 'user', 'has_access_to', hash( 'module', 'notification', 'function', 'use' ) )}
<form method="post" action={'content/action'|ezurl}>
    <input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
    <input type="submit" class="button" name="ActionAddToNotification" value="{'Keep me updated'|i18n( 'design/standard/node/view' )}" />
</form>
{/if}

The form token extension (ezformtoken, active on every installation) adds its token to the form when the page is rendered.

What the visitor sees

  • A confirmation page, "Notify me about updates", with Notify me and Cancel.
  • When the item is already followed: "You already follow this item", with Stop notifications for this item.
  • After confirming, the visitor is sent back to the page.

The design standard already has the button in node/view/full.tpl, labeled "Notify me about updates". Anonymous visitors cannot follow content: they need to sign in, and their role needs notification/use.

Related pages

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.