Pro module24 abilities

Tutor LMS ability reference

Reference for the GoBuildWP Pro 1.12.4 source. Installed schemas and policy remain authoritative.

This Tutor LMS ability reference covers how an agent builds and maintains Tutor LMS courses, from topics and lessons to quizzes and their questions, reads learners' enrolments and quiz results, and enrols or unenrols a learner on a course that is not for sale.

Read-only, write and destructive groups describe the source annotations. They do not establish a minimum safety profile, human approval or undo support. Those controls are separate: check the installed ability, the connected user and the active site policy before calling it. A read can still return sensitive data. These pages are not evidence that every operation passed an end-to-end runtime test.

What Tutor LMS needs before these load

Tutor LMS 4.0.0 or newer must be active; the gate needs TUTOR_VERSION, tutor(), tutor_utils() and the Tutor\Models\CourseModel and EnrollmentModel classes. Reading courses and enrolments, and enrolling or unenrolling, use GoBuildWP's standard manage_options check. Authoring and quiz results need manage_tutor or manage_options, because Tutor scopes an instructor's edit_tutor_course to their own courses while these calls work on any course. tutor-lms-check-setup reports the version, whether Tutor Pro is active and the monetisation provider.

Minimum (base)
4.0.0 WPPILOT_PRO_TUTOR_LMS_MIN_VERSION
Tutor LMS editions
free, pro
Agent skills shipped
tutor-lms-integration

Enrolment checks Tutor’s purchasable flag

tutor-lms-enroll-user refuses any course Tutor considers purchasable, returning tutor_lms_paid_course_requires_checkout, which enforces that Tutor checkout boundary. Memberships and other paid-access arrangements need separate checks. For a free course it enrols through EnrollmentModel and then checks that a completed enrolment exists. tutor-lms-unenroll-user deletes the enrolment record for one learner and course but refunds nothing and cancels no payment or subscription; enrolment rows carry order_id and product_id so the agent can point at the order. Both are destructive and need confirm: true. Quiz results name the learner by id and display name with marks and dates, never email, IP or answers.

Which Tutor writes rollback-change can reverse

Courses, topics, lessons and quizzes are posts, and quiz settings sit in the tutor_quiz_option meta, so those writes are in the change ledger: undoing a create trashes the new item, and updates to a course, lesson or quiz settings are restored. Instructors added to a course are user meta and are not restored. Deleting a course or lesson trashes it by default; force=true is permanent, and for a course Tutor then removes its topics, lessons, quizzes, quiz attempts and enrolments, which dry_run counts in advance.

Questions and answers live in {prefix}tutor_quiz_questions and {prefix}tutor_quiz_question_answers, which the ledger cannot restore. Adding one is undone by deleting it; an update returns the previous question and answers; a delete returns the removed rows, and its dry_run shows how many recorded attempt answers point at the question. Reordering a course rewrites many posts at once, so it stays out of the ledger, returns the previous order to re-apply, and accepts at most 500 items with every topic and item listed once.

Representative call sequence

This sequence describes the documented calls and checks to perform. It is not a recorded result from an installed WordPress site. Inspect returned errors and partial results, then verify the saved values and affected output before proceeding.

Add a true or false question to the Module 2 quiz and see who has passed so far.

  1. 01 wppilot/tutor-lms-get-course-structure Returns the course's topics with their lessons and quizzes in order, giving the Module 2 quiz id.
  2. 02 wppilot/tutor-lms-add-quiz-question Appends a true_false question with its answers to that quiz in Tutor's question tables.
  3. 03 wppilot/tutor-lms-get-grades Summarises each learner's attempts, highest and latest percentage, and whether the passing grade was reached.

Tutor LMS in practice

Writing Tutor LMS quiz questions that pass validation

wppilot/tutor-lms-add-quiz-question accepts five question types: true_false, single_choice, multiple_choice, open_ended and fill_in_the_blank. Each has its own shape, and a mismatch returns tutor_lms_invalid_question with the reason. A true_false question takes a single correct flag and the True and False answers are built for you. A choice question needs between 2 and 20 answers, each with a title; single_choice must mark exactly one as correct and multiple_choice at least one. A fill_in_the_blank question uses {dash} in blank_text for every gap, and the number of placeholders must equal the number of blanks given.

Open-ended answers cannot be marked automatically, so attempts that include them show result pending until an instructor reviews them in Tutor. A pass rate read straight after a quiz with open-ended questions will look lower than it really is.

Quiz settings that change how learners are scored

passing_grade is a percentage from 0 to 100. time_limit takes a value and a unit from seconds to weeks, with 0 meaning no limit. Setting attempts_allowed switches the attempt limit on by itself unless limit_attempts is sent too. max_questions draws that many questions per attempt rather than showing the whole bank, questions_order is rand, sorting, asc or desc, and pass_required stops a learner from continuing until they pass. feedback_mode (default, reveal or retry) is translated into Tutor's own answer-reveal and retry settings, so check the quiz in Tutor afterwards to see how it reads there.

wppilot/tutor-lms-get-grades summarises one course, optionally for one learner, and stops after reading 5,000 attempts, saying the summary is partial. For the attempts themselves, wppilot/tutor-lms-list-quiz-attempts filters by quiz, learner and result (pass, fail or pending) and returns 20 per page by default, up to 100; filtering on pending is the quickest way to find what still needs marking. Courses with more than 500 topics, lessons and quizzes are refused by wppilot/tutor-lms-reorder-course-content with tutor_lms_reorder_too_large, and have to be reordered in Tutor's course builder.

Questions about Tutor LMS

Can the agent enrol someone on a paid course?

The call refuses a course that Tutor reports as purchasable. That does not detect every membership or other paid-access arrangement; check those separately before granting access.

Does unenrolling a learner refund them?

No. It deletes the enrolment record alone; any refund or subscription cancellation happens in the order system.

Can I undo a deleted quiz question?

Not from the change ledger, because questions live in Tutor's own tables. The delete cannot be undone. It returns the removed question and answers, so the same content can be added again with tutor-lms-add-quiz-question, but that creates a new question with a new id: recorded attempt answers that pointed at the old question are not reattached to it. Run the delete with dry_run first to see how many attempt answers are affected, and keep a database backup if they matter.

Tutor LMS reads

AbilityWhat it does
wppilot/tutor-lms-check-setupCheck Tutor LMS SetupReports Tutor LMS Free/Pro runtime, course counts, configured monetization provider, key post types, and course administration capability.
wppilot/tutor-lms-get-courseGet Tutor LMS CourseReads one Tutor LMS course with content, author, price/monetization state, taxonomy, and curriculum counts.
wppilot/tutor-lms-get-course-structureGet Tutor LMS Course StructureReads a course curriculum as topics, each with its lessons, quizzes and assignments in display order, including drafts. Read-only; no answers or learner data.
wppilot/tutor-lms-get-gradesGet Tutor LMS Quiz GradesSummarises quiz results for one course: per learner and quiz, the attempt count, best and latest percentage, latest result and whether the passing grade was reached. Tutor Pro Gradebook letter grades are not included.
wppilot/tutor-lms-get-quizGet Tutor LMS QuizReads a quiz with its settings and every question and answer, including which answers are correct. Administrator data.
wppilot/tutor-lms-get-user-enrollmentsGet User Tutor LMS EnrollmentsReads a user’s Tutor LMS enrollment records without returning email, profile fields, quiz attempts, payment details, or order contents.
wppilot/tutor-lms-list-course-contentList Tutor LMS Course ContentLists a course curriculum in topic/menu order with lesson and quiz IDs, titles, types, status, topic identity, and bounded pagination.
wppilot/tutor-lms-list-coursesList Tutor LMS CoursesLists Tutor LMS courses with price mode, curriculum counts, author, categories, status, and bounded pagination.
wppilot/tutor-lms-list-quiz-attemptsList Tutor LMS Quiz AttemptsLists finished quiz attempts with learner id and display name, marks, percentage, result and dates, filtered by course, quiz or learner. No email, IP address or answers.

Tutor LMS writes

AbilityWhat it does
wppilot/tutor-lms-add-quiz-questionAdd Tutor LMS Quiz QuestionAppends one question (true_false, single_choice, multiple_choice, open_ended or fill_in_the_blank) with its answers to a quiz. Written to Tutor's own tables, so the change ledger cannot undo it; delete the question instead.
wppilot/tutor-lms-create-courseCreate Tutor LMS CourseCreates a Tutor LMS course (draft by default) with description, categories, tags, level, duration, price type, requirements, audience, materials, featured image and instructors. Paid courses link an existing WooCommerce product or set a native price; no product is created.
wppilot/tutor-lms-create-lessonCreate Tutor LMS LessonAdds a lesson at the end of a topic with content, video source, duration, preview flag, attachments and featured image.
wppilot/tutor-lms-create-quizCreate Tutor LMS QuizAdds a quiz at the end of a topic with Tutor's default settings plus any given here. Add questions afterwards.
wppilot/tutor-lms-create-topicCreate Tutor LMS TopicAdds a topic (section) at the end of a course curriculum.
wppilot/tutor-lms-reorder-course-contentReorder Tutor LMS Course ContentSets topic order and the order and topic of every lesson, quiz and assignment in one course. Every current topic and item must be listed exactly once. dry_run=true returns the planned moves. Returns the previous order.
wppilot/tutor-lms-update-courseUpdate Tutor LMS CourseUpdates only the given fields of a Tutor LMS course and returns the before/after values. Reversible through the change ledger except added instructors.
wppilot/tutor-lms-update-lessonUpdate Tutor LMS LessonUpdates only the given lesson fields (title, content, video, duration, preview flag, attachments, featured image) and keeps the rest. Reversible through the change ledger.
wppilot/tutor-lms-update-quiz-questionUpdate Tutor LMS Quiz QuestionRewrites one question's text, mark and flags; when answer fields are given they replace all of its answers. The type cannot change. Returns the previous question and answers because the change ledger cannot restore Tutor's question tables.
wppilot/tutor-lms-update-quiz-settingsUpdate Tutor LMS Quiz SettingsChanges a quiz's title, description, time limit, attempts, passing grade, feedback mode, question count, order or pass requirement, keeping every setting not given. Reversible through the change ledger.

Destructive Tutor LMS calls

AbilityWhat it does
wppilot/tutor-lms-delete-courseDelete Tutor LMS CourseMoves a Tutor LMS course to the trash (default, reversible). force=true deletes it permanently, and Tutor then deletes its topics, lessons, quizzes, quiz attempts and enrollments with it. dry_run=true reports what would go.
wppilot/tutor-lms-delete-lessonDelete Tutor LMS LessonMoves a lesson to the trash (default, reversible, keeps its attachments). force=true deletes it permanently as Tutor's builder does.
wppilot/tutor-lms-delete-quiz-questionDelete Tutor LMS Quiz QuestionPermanently deletes one quiz question and its answers from Tutor's tables. Not undoable; the deleted rows are returned. dry_run=true shows the rows and how many recorded attempt answers point at the question.
wppilot/tutor-lms-enroll-userEnroll User in Free Tutor LMS CourseEnrolls an existing user through Tutor LMS EnrollmentModel only when the course is not purchasable. The guard checks Tutor's purchasable flag; it does not detect every membership or other paid-access arrangement. Check those separately before granting access.
wppilot/tutor-lms-unenroll-userUnenroll User from Tutor LMS CoursePermanently removes the Tutor LMS enrollment record for one user/course pair. It does not refund an order or cancel a payment/subscription.

For the task-level view of Tutor LMS, with worked requests and what to check afterwards, see Tutor LMS integration page.