Email Templates
Translating
Follow Button
Updated
Sometimes, rather than a form, it’s nice to have a single button that allows the creation of a simple subscription. This could be referred to as a ‘Follow’ Button.
Content Notify has this feature, out-of-the-box, providing that the user is logged in. If the user is logged out, they will still be shown a few fields, as mentioned below.
The Shortcode
To do this, you need to set up the Content Notify form shortcode in a specific way. Here’s an example of a working ‘Follow’ button set-up for a logged in user:
[cn_form user_fields="false" user_names="false" post_id="auto" authors="false" taxonomies="false" search="false" privacy_policy="false" captcha="false" submit_label="Follow Post"]
In this shortcode, you’re essentially asking the form to:
- Not show the user fields – i.e. the email address, first name, and last name to logged in users.
- Not show the name fields – i.e. the first name and last name to logged out users.
- Set the post ID to the current post. This also sets the post_type to the post type of the current post and the status to ‘update’.
- Not show the authors field.
- Not show the taxonomies field.
- Not show the keyword search field.
- Not show the privacy policy field to logged in users.
- Not show the CAPTCHA field.
- Change the ‘Create Subscription’ button text to say ‘Follow Post’ instead.
Once all set, for a logged in user, this will output a single ‘Follow’ button on the page which will set-up the subscription using the above shortcode parameters.
For a logged out user, it will still show the email address, and privacy policy checkbox fields. This is because:
- We need an email address in order to create a subscription. A logged in user will have an email address stored in WordPress that we can use but a logged out user needs to provide one.
- We need the user to agree to the Privacy Policy to comply with the various privacy laws around the world. It is assumed a logged in user has already agreed to these somewhere upon registration.
Once set-up, this form provides a neat and powerful way of creating simple subscriptions using Content Notify.