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

Start free trial

LearnDash Manage Achievement

learndash/manage-achievement creates a new achievement badge or updates an existing one.

Status defaults to publish here rather than draft, which is the opposite of most creation abilities.

At a glance

Abilitylearndash/manage-achievement
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Achievements
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyWrites data
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI Pro 0.9.16 and later

How it works

The reason is that an achievement only fires when published. A draft badge is not a staged badge — it is an inert one, and a badge created as a draft and forgotten is a badge nobody ever earns.

Since there is no useful staging state, defaulting to draft would mostly produce silent failures.

The trigger decides what earns it, and must be a key from learndash/list-achievement-triggers.

Scope it with course_id, lesson_id, topic_id, quiz_id or group_id: a post ID restricts it, the string all is a wildcard, and omitting the key is right for triggers where it does not apply.

occurrences set to 0 means unlimited repeats, which is what makes a streak badge work.

Idempotent.

Input

NameTypeRequiredWhat it is
actionstringYescreate or update.
achievement_idintegerFor updateWhich achievement.
titlestringFor createThe badge name.
triggerstringFor createA key from learndash/list-achievement-triggers.
pointsintegerNoPoints the badge carries.
occurrencesintegerNo0 for unlimited repeats.
course_idstring | integerNoA post ID to restrict, all as a wildcard, or omit.
quiz_idstring | integerNoAs above.
group_idstring | integerNoAs above.
statusstringNo — defaults to publishAn unpublished achievement never fires.

What comes back

NameTypeWhat it is
achievementobjectThe achievement after the write.
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:

Create a badge for completing the onboarding course.

It resolves to one call:

{
  "ability": "learndash/manage-achievement",
  "parameters": {
    "action": "create",
    "title": "Onboarding complete",
    "trigger": "course_completed",
    "course_id": 412,
    "points": 10
  }
}

Worth knowing

  • Published by default, because a draft badge is inert rather than staged.
  • The trigger must exist on this site.
  • occurrences: 0 means unlimited repeats.
  • An omitted scope key and all are different.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading