30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

LearnDash Get Access Info

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

Abilitylearndash/get-access-info
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Enrolment & Access
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyRead-only — changes nothing
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI 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

NameTypeRequiredWhat it is
learnerstring | integerYesUser ID, login or email.
course_idintegerYesThe course.

What comes back

NameTypeWhat it is
has_accessbooleanThe overall verdict.
directly_enrolledbooleanWhether they hold the course directly.
via_groupobjectThe group granting access, if that is where it comes from.
access_fromstringWhen access started.
expiresstringWhen it expires, if it does.
expiredbooleanWhether it already has.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent 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


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading