CartThrob 10 documentation for ExpressionEngine commerce teams Visit CartThrob.com
CartThrob.com

Has Subscription Permission

Use has_subscription_permission to protect content based on subscription permission access.

This tag checks CartThrob permission assignments linked to Subscriptions. These assignments are front-end access grants attached to members; they are separate from ExpressionEngine roles and Control Panel permissions. Changing a member’s ExpressionEngine roles does not grant or revoke this access.

The visitor must be logged in. The tag first finds the member’s qualifying Subscriptions, then checks their linked permission assignments. A Subscription qualifies when its status is Open or its end date is still in the future. A Closed Subscription whose end date has passed does not grant access. The future end-date rule preserves access through a paid period when renewal has stopped but the customer is still entitled to the content. See Subscription statuses and access.

More precisely, a Subscription qualifies when it is Open with no End Date or a future End Date, or Hold, Pending or Closed with a future End Date. A completed cancellation refund ends access immediately, and a cancellation refund under review lasts no longer than its paid-through date. Access ends at the End Date without waiting for the rebill command. See Which permission tag should I use?

To check a CartThrob permission assignment without requiring a qualifying Subscription, use has_permission.

For access checks against the current visitor, use member_id="CURRENT_USER" or omit member_id. Explicit member IDs are intended for controlled template logic and should not come from URL parameters or other visitor-supplied input.

Parameters
permissions

One or more permission IDs (pipe-delimited).

permissions="123|456"
member_id

Member ID to evaluate. Supports CURRENT_USER, {member_id}, and {logged_in_member_id}.

When omitted, the tag evaluates the logged-in member.

member_id="CURRENT_USER"
Conditionals

{if no_results}

Outputs alternate content if the member does not have qualifying permissions.

Example
{exp:cartthrob:has_subscription_permission permissions="123" member_id="CURRENT_USER"}
    Some content!

    {if no_results}
        You don't have access to this content.
    {/if}
{/exp:cartthrob:has_subscription_permission}