learndash/get-access-info reports whether a learner can open a course, and the signals behind the verdict.
The signals are the point.
At a glance
| Ability | learndash/get-access-info |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Enrolment & Access |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Read-only — changes nothing |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Pro 0.9.16 and later |
How it works
Access to a course can come three ways: direct enrolment, membership of a group that carries the course, or the course being open to everyone. A bare yes-or-no would not tell you which, and changing the wrong one changes nothing.
So the response returns the overall verdict plus whether they are directly enrolled, whether access comes from a group instead, when access started, when it expires and whether it already has.
Access can also be revoked by expiry rather than by anybody removing it, which is the answer to “they were enrolled last month and now they are not” more often than anything else.
The start date is what drip-feed counts from, so it explains a learner who has access and sees no content.
Run this before learndash/enroll-user or learndash/unenroll-user. Unenrolling somebody whose access came from a group does nothing, because the group is still granting it.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
learner | string | integer | Yes | User ID, login or email. |
course_id | integer | Yes | The course. |
What comes back
| Name | Type | What it is |
|---|---|---|
has_access | boolean | The overall verdict. |
directly_enrolled | boolean | Whether they hold the course directly. |
via_group | object | The group granting access, if that is where it comes from. |
access_from | string | When access started. |
expires | string | When it expires, if it does. |
expired | boolean | Whether it already has. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Why can this learner not open the course?
It resolves to one call:
{
"ability": "learndash/get-access-info",
"parameters": {
"learner": "sam@example.com",
"course_id": 412
}
}Worth knowing
- Three sources of access, and unenrolling only affects one of them.
- Expiry revokes access without anybody doing anything.
- The start date is what drip-feed counts from.
- Read-only.
Related abilities
- LearnDash Enroll User — grant access
- LearnDash Unenroll User — take it away
- LearnDash Set Enrollment Date — change what drip counts from
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category