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

Has Permission

Checks whether a member has at least one of the requested permission IDs.

This tag checks CartThrob Assigned Permission records. These are front-end access grants linked directly to members; they are separate from ExpressionEngine roles and Control Panel permissions. Changing a member’s ExpressionEngine roles does not change the result of this tag.

This tag is provided by the bundled Permissions Manager add-on (cartthrob_permissions_manager), not by the Subscriptions tag set directly.

This tag does not check Subscriptions. An assignment created by a Subscription stays in place after the Subscription is cancelled, closed or refunded, so this tag keeps allowing access. A changed Plan permission list can also recreate an assignment an administrator deleted. For content that should follow a subscription, use has_subscription_permission. See Which permission tag should I use?

Parameters
permissions (required)

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}.

If omitted, the logged-in member is used.

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.

Conditionals

{if no_results}

Rendered when no matching permission records are found.

Example
{exp:cartthrob:has_permission permissions="123|456" member_id="CURRENT_USER"}
    <p>Access granted.</p>

    {if no_results}
        <p>Access denied.</p>
    {/if}
{/exp:cartthrob:has_permission}