Checking User Subscriptions (if_user_is_subscribed)
The "if_user_is_subscribed" construct allows you to check if the currently logged-in user has an active subscription to any subscription product in Aurora.
This article describes how to use this function to customise your content on the Aurora front-end.
Introduction
The if_user_is_subscribed function allows you to check if the currently logged-in user has an active subscription to any subscription product in Aurora, and present different content to the user based on the result.
If the visitor is not logged in, then the visitor is assumed NOT to be a subscriber.
This can be used to promote your subscriptions to users that doesn't already have them, or present content to users that does, i.e. present a subscriber with some 'pay-for' subscription section of the Store.
How to use this function
Example Aurora Template: templates/example.com/products/details.tpl.html
This construction should be used as follows:
{if_user_is_subscribed product_id="123"}
YOUR SUBSCRIBER CONTENT HERE...
{if_user_is_subscribed_else}
YOUR NON-SUBSCRIBER CONTENT HERE...
{/if_user_is_subscribed}
Parameters
Parameter | Values | Default | Description | Required? |
---|---|---|---|---|
product_id | Integer | N/A | The Internal ID Aurora uses to identify a subscription Product. | One of product_reference or product_id is required (not both). |
product_reference | String | N/A | The Aurora Product Reference for the subscription product you wish to check. | One of product_reference or product_id is required (not both). |
You may only provide the ID or Reference of a product that is actually configured to be a Subscription product. If you do not, then the content block will not work and instead it will fail silently.
Note: You can use the Smarty Debug Toolbar provided under Smarty 3 in Aurora to view errors reported when this occurs.
Examples
Example Aurora Template: templates/example.com/products/details.tpl.html
{if_user_is_subscribed product_reference="SKU123456"}
YOUR SUBSCRIBER CONTENT HERE...
{if_user_is_subscribed_else}
YOUR NON-SUBSCRIBER CONTENT HERE...
{/if_user_is_subscribed}
Updated over 2 years ago