Subscriptions

Updated

This add-on allows a user to manage the BNFW notifications that they’re opted into via a series of checkboxes in their profile in the WordPress Admin, or via the front-end form which can be added to any page using a shortcode.

Settings

On installing this add-on, new settings become available under Notifications > Settings. These settings allow a site admin to set the initial subscription state for notifications – users are either opted in by default or opted out by default. This can easily be set for all users when the add-on is first installed however, after this, once a user has saved their subscription preferences for the first time, either by going to their profile in the WP Admin or via the front-end form, toggling this radio button will not change all user’s subscription preferences.

That being said, if the default setting is to opt-in users, every time the admin creates a new notification, the user will be opted into it by default which may not be what the user wants.
There is another radio button at the top of the list of notifications in the users profile, that overrides the default subscription preference for each user in order to allow them to ensure that they aren’t opted into notifications that they don’t want.
E.g. If the default setting is set to ‘Opt-in’ the user can set their Subscription preference to ‘Opt-out’ so that when a new notification is created, they are not opted into it by default, thereby allowing a user to override the default setting, just for themselves.
There is also a setting under Notification > Settings that allows the admin to set the default state of this radio input.

Admins can also choose which notifications are available for a user to opt in/out via the new ‘Subscriptions’ meta box below the Save button when editing a notification.

Shortcodes

The [cc lang=”php” inline=”true”][user_subscription_page][/cc] shortcode can be added to a notification which will output a link to the user’s profile in the WP Admin where they can change their subscription preferences.

Users’s that have access to their Profile in the WordPress Admin can change their subscriptions.

Alternatively, if access to the WP Admin is restricted or blocked entirely, you can add the [cc lang=”php” inline=”true”][bnfw_user_subscriptions][/cc] shortcode to any page in order to show a front-end version of this form. You could then include a link to this page in a notification so that users can manage their subscriptions more easily. It’s worth noting that this won’t output anything if the user isn’t logged in so it might be worth using a plugin, such as Members, in order to put this page behind a login prompt to ensure correct operation.

Users’s can also change their subscriptions on the front-end of a website, as shown using the default Twenty Twenty-One theme.

Notification Names

The title of each notification is used as the field label for each row in the subscriptions form.

Important Notes

In rare circumstances, on sites with large (1GB+) databases, the [cc lang=”php” inline=”true”][bnfw_user_subscriptions][/cc] shortcode may cause high CPU usage. This can be remedied by unchecking the ‘Enable Content Shortcodes?’ option in Notifications > Settings.

Questions?

Still have a question? Ask me a pre-sales question here and i’ll gladly help.