CartThrob Permissions Manager
Overview
CartThrob Permissions Manager is the administrative layer for permissions in CartThrob. It gives you two main tools:
- define reusable permission items (for example,
premium_articles,video_library,course_level_2) - assign or remove those permissions for members
This module works with core CartThrob permission tags and is bundled with the Subscriptions package in this release.
CartThrob Permissions and ExpressionEngine Roles
CartThrob permissions are front-end access grants, not ExpressionEngine roles or Control Panel permissions. A Permission Item defines a type of access, and an Assigned Permission links that access to a specific member.
For example, a site might have a Permission Item named Video Library with ID 7. When member 42 receives access, CartThrob stores an assignment resembling:
| Field | Example | Meaning |
|---|---|---|
member_id |
42 |
Member receiving access |
permission |
7 |
Permission Item being granted |
order_id |
901 |
Related order, when applicable |
sub_id |
123 |
Related Subscription, when applicable |
An assignment can be created by:
- a successful CartThrob purchase that includes the Permission Item
- a Subscription Plan that includes the Permission Item
- an administrator using Assigned Permissions
Template tags check these assignment records when deciding whether to show protected content. Changing a member’s ExpressionEngine roles does not create, alter, or remove their CartThrob permission assignments. The assignment remains until an administrator removes it or CartThrob explicitly synchronizes or removes the linked access as part of a purchase or Subscription lifecycle operation.
This separation allows one member to have several purchased access grants without changing their ExpressionEngine account privileges. For example, a member can have access to Video Library, Premium Downloads, and October Conference while their ExpressionEngine roles remain unchanged.
The two most common access tags answer different questions:
has_permissionchecks whether the member has the requested CartThrob permission assignment.has_subscription_permissionchecks for the assignment through an Open or unexpired Subscription.
Requirements
- CartThrob Permissions Manager
6.0.0 - CartThrob
10.0.1+(Permission and PermissionItem models) - PHP
>= 8.0 - ExpressionEngine
6.1+
Installation
Bundled path in this package:
/system/user/addons/cartthrob_permissions_manager/
Install via ExpressionEngine Control Panel:
- Go to
Add-ons. - Install
CartThrob Permissions Manager. - Run add-on updates if prompted.
The updater installs:
- add-on components
cartthrob_permissions_managerfieldtype- tables:
cartthrob_permissions,cartthrob_permission_items,cartthrob_permissions_manager_settings
Upgrading
- Deploy updated files in
/system/user/addons/cartthrob_permissions_manager/. - Go to
Add-onsand run add-on updates. - Re-open Permissions Manager and verify:
- permission items list loads - assigned permissions list loads - create/edit forms save without validation errors
Start Here (10-Minute Setup)
Goal: create one permission item, sell or assign it, and protect one piece of content.
Prerequisites Checklist
- CartThrob is installed and active.
- Permissions Manager is installed.
- You have a test member account.
- You know which content should be protected.
First Success Path
- Create a permission item in
Permissions(for example,Premium Access). - Assign that permission to a test member using
Assigned Permissions. - Wrap protected template content with
has_permission. - Confirm the member can see content when assigned and cannot when removed.
Common Tasks With Examples
1. Create a Reusable Access SKU
Goal: define access once and reuse it in products, subscriptions, and manual assignment.
- Go to
Permissions. - Click
New. - Set
Title:Premium Video Library. - Add a short
DescriptionandAccess overview. - Keep
Statusasopenand save.
Outcome: this permission item can be attached to cart actions, subscriptions, or manual grants.
2. Manually Grant Access to a Customer
Goal: give immediate access without checkout.
- Go to
Assigned Permissions. - Click
New. - Enter
member_id. - Choose a
permissionfrom the dropdown. - Optionally set
order_id,item_id, andsub_id. - Save.
Outcome: member receives access immediately, and the assignment appears in list views and template tags.
3. Sell Access Through CartThrob Checkout
Goal: add permission IDs when adding an item to cart.
{exp:cartthrob:add_to_cart_form entry_id="{entry_id}" permissions="12|15" return="store/cart"}
<button type="submit">Buy Access</button>
{/exp:cartthrob:add_to_cart_form}
Outcome: successful order creates permission assignment records for the member.
4. Protect Content by Permission
Goal: allow only members with specific permissions.
{exp:cartthrob:has_permission permissions="12|15" member_id="CURRENT_USER"}
<h2>Premium Content</h2>
<p>Only authorized members can see this block.</p>
{if no_results}
<p>You do not have access.</p>
{/if}
{/exp:cartthrob:has_permission}
Outcome: content is rendered only when one of the requested permissions is assigned.
Quick Links For Existing Users
- Need to manually grant/revoke member access: see
Assigned Permissions. - Need to manage access catalog: see
Permission Items. - Need template checks: see
has_permissionandpermissionstags. - Need Subscriptions integration flow: see Using With Subscriptions.
Control Panel Reference
The Control Panel screens are documented on their own page, Permissions Manager Control Panel:
- Assigned Permissions: columns, search, filters, and the assign, edit and delete forms.
- Permissions: Permission Items, their status, and the reference check that runs before a Permission Item can be deleted.
Fieldtype Reference
Fieldtype: cartthrob_permissions_manager
Use this fieldtype on product channels to attach one or more permission IDs to entries.
Publish/Edit UI Behavior
- renders as multi-select of existing permission items
- selected values are stored as encoded multi-value data
Template Output
Single variable
Outputs pipe-delimited permission IDs.
{permissions}
Example output: 1|3|11
Supported parameter:
limit: truncates output to N IDs
Variable pair
Loops through selected permission IDs and exposes permission item data.
{permissions limit="10"}
{count}. {id} - {title} ({status})
{/permissions}
Pair variables from permission item lookup:
countidtitledescriptionaccess_overviewstatus
Supported parameters:
limitbackspace
Template Tags
permissions
Returns permission assignment rows from cartthrob_permissions.
Parameters
id
- permission assignment record ID(s) - pipe-delimited supported
order_id
- filter by linked order entry ID(s)
- pipe-delimited supported
- can’t be combined with id
item_id
- filter by item ID(s) - pipe-delimited supported
permission
- filter by permission item ID(s) - pipe-delimited supported
member_id
- defaults to current member when omitted
- supports CURRENT_USER, {member_id}, {logged_in_member_id}
- ExpressionEngine Super Admins can request another member and all assigned roles are considered
- other members are restricted to their own member ID
limit
- max rows to return
- default: 100
order_by
- sort column
- default: id
sort
- asc or desc
- default: desc
- applied when order_by is present
sub_id
- filters assignments by linked Subscription ID - pipe-delimited supported - the linked Subscription must be Open or have an end date in the future
Variables
{id}assignment row ID{member_id}member receiving permission{order_id}order entry ID{item_id}item identifier{permission}permission item ID{sub_id}subscription linkage ID (when present)
Conditionals
{if no_results}rendered when no matching assignments exist
Example
{exp:cartthrob:permissions member_id="CURRENT_USER" permission="12|15" limit="25" order_by="id" sort="desc"}
<li>Permission {permission} (record {id})</li>
{if no_results}
<li>No permissions found.</li>
{/if}
{/exp:cartthrob:permissions}
has_permission
Checks whether a member has one of the given permission IDs.
Parameters
permissions(required)
- permission item ID(s), pipe-delimited
member_id
- optional member target
- supports CURRENT_USER, {member_id}, {logged_in_member_id}
- defaults to current member
Conditionals
{if no_results}for alternate output when access check fails
Example
{exp:cartthrob:has_permission permissions="12|15" member_id="CURRENT_USER"}
<p>Access granted.</p>
{if no_results}
<p>Access denied.</p>
{/if}
{/exp:cartthrob:has_permission}
permission_items
Returns permission item details from cartthrob_permission_items.
Parameters
id(required for output)
- permission item ID to retrieve
status
- defaults to open when id is provided
- typical values: open, closed
Variables
{id}permission item ID{status}open/closed{title}title{description}description{access_overview}access summary
Conditionals
{if no_results}when item does not match filters
Example
{exp:cartthrob:permission_items id="12" status="open"}
<h3>{title}</h3>
<p>{description}</p>
<p>{access_overview}</p>
{if no_results}
<p>Permission not available.</p>
{/if}
{/exp:cartthrob:permission_items}
Using With Subscriptions
Permissions Manager is the access layer; Subscriptions supplies recurring billing and plan lifecycle. Use them together for recurring access products.
Recommended Flow
- Create permission items in Permissions Manager.
- In Subscriptions Plan setup, select one or more permissions in the Plan’s Permissions checklist.
- Sell the subscription Plan.
- When a Subscription is created, Subscriptions assigns those permissions to the member and links each assignment to the Subscription.
- Protect subscription content with
has_subscription_permission.
Choosing the access tag
has_subscription_permissiongrants access only through a Subscription that is Open or has an End Date in the future, so access follows billing and paid-through periods.has_permissionchecks only whether the assignment exists. Subscription assignments are not removed when a Subscription is cancelled, closed or placed on Hold, so a former subscriber still passeshas_permission. Use it for access that should last once granted.
See Subscription statuses and access for when a Subscription stops qualifying.
Deleting a Subscription’s assignment is not a permanent block. Changing the Plan’s permission list, saving the Subscription in the Control Panel, a Plan change or a new purchase can assign it again. See the worked example.
What This Gives You
- Plans grant permission assignments automatically when a Subscription is created, and a Plan change replaces the old Plan’s assignments with the new Plan’s.
- Changing a Plan’s permission list synchronizes the assignments of the Subscriptions on that Plan; see Editing Plan Permissions.
- Support teams can still inspect and adjust individual assignments in Assigned Permissions. The Subscription ID column shows which Subscription created an assignment.
Implementation Notes
- Subscriptions links each assignment it creates to its Subscription ID.
- The Subscriptions Control Panel requires Permissions Manager to be installed.
Known Limitations
- The
permission_itemstag returns data only whenidis provided, and only for an Open item unless you setstatus. - Assign Permission blocks assigning the same Permission to the same member twice. Assignments created by Subscriptions are not checked this way, so a member with two Subscriptions that grant the same Permission has two assignments.
- Deleting an assignment linked to a Subscription is not a permanent block; see Using With Subscriptions.
Changelog
Permissions Manager release notes, including Version 6.0.0, are on the Permissions Manager changelog page. Billing and Subscription changes are in the Subscriptions changelog.