Developer & API

Gather Grove Courses is built to be extended — and, deliberately, to be extended at its seams: a handful of filters are the sanctioned indirection points for identity, access, and checkout, and they’re stable contracts. This page is the orientation; exact signatures live as docblocks at each hook in the plugin source.

Conventions

  • Hook prefix: gather_grove/courses/ (slash-style); suite-wide coordination hooks drop the plugin segment (e.g. gather_grove/cohort_created).
  • REST namespace: /wp-json/gather-grove/courses/v1/.
  • PHP namespace: GatherGroveCourses. Tables: wp_gg_courses_*. CSS prefix: .gg-courses-.
  • Capabilities: gg_manage_courses, gg_manage_enrollments, gg_view_enrollments, gg_view_own_progress — never manage_options.

The seams (filters)

FilterWhat it decides
enroll_urlThe checkout/enroll destination for a locked course ( $url, $course_id, $member_id ). Empty string = no button. Booking wires Stripe Checkout here; wire your own for free or custom enrollment.
lesson_payloadA lesson’s decoded content before render ( $payload, $lesson_id, $member_id ) — the player’s one render seam. There is no “after lesson content” action hook; if you need to add to a lesson, transform its payload here.
can_view_courseFinal say on view access ( $can_view, $member_id, $course_id ) — express comps, bundles, trials.
can_enrollFinal say on enroll eligibility (the prerequisite gate’s output).
playback_ratesThe speeds the player’s menu offers ( $rates ), ascending, 1.0 = normal. It feeds core’s gather_grove/player/rates, which sanitizes the result (0.25–4, unique, never empty), so it applies to every Gather Grove player on the site.
member_has_library_accessResolves the all-access tier at read time ( $has, $member_id ).
resolve_member_idWP user → Member id mapping ( $member_id, $wp_user_id ); default is identity.
lesson_unlocked / gate_bypass / drip_modelFinal say on a lesson’s drip/prerequisite state, the manager see-everything bypass, and the drip model in force.
recording_eligibleMay a member watch a session recording under the lesson’s recording policy.
certificate_templateThe template slug at issuance ( $template, $course_id, $member_id ).
instructor_optionsThe instructor dropdown in the course settings box (WordPress user id → label). Courses fills this itself — Booking’s instructors when Booking is active, teaching-role users otherwise — and returns your value untouched if you answer first.
learning_tab_labelThe label of Courses’ tab in the member portal ( $label ), applied after the Member wording setting (default “Learning”). An empty return falls back to “Learning”. A dashboard that lets editors rename tabs per widget should match Courses’ entry on gather_grove/portal/tabs by its stable id library and replace its label.
instructor_field_noticeA short note shown under that dropdown. Courses uses it to name Booking instructors who have no login account yet, and so cannot be selected.

React to events (actions)

  • lesson_completed ( $member_id, $lesson_id, $context ) — context carries the course and how it completed (attendance / recording / manual / quiz).
  • course_completed ( $member_id, $course_id, $certificate_id ) — the certificate is issued before this fires.
  • enrollment_created ( $enrollment_id, $member_id, $course_id, $cohort_id ) and enrollment_cancelled ( $enrollment_id, $reason ).
  • enrollment_cohort_changed ( $enrollment_id, $member_id, $course_id, $old_cohort_id, $new_cohort_id ) — an existing enrollment moved into, between, or out of cohorts (0 on either side means “no cohort”). Fires only on a real change, from the builder’s roster controls or POST /enrollments/{id}. Communities uses it to keep cohort-space rosters current.
  • quiz_passed / quiz_failed ( $member_id, $quiz_id, $score ).
  • certificate_issued ( $certificate_id, $member_id, $course_id ).
  • course_updated ( $course_id, $changed_fields ) — fires on any builder change; use it to bust caches.
  • Suite-wide: gather_grove/cohort_created and gather_grove/cohort_archived — how Communities auto-provisions cohort spaces.

REST

All under gather-grove/courses/v1. Builder routes require gg_manage_courses + nonce; progress routes are member-scoped.

RoutePurpose
GET /courses/{id}/builderThe full course tree for the builder.
POST /courses/{id}/modules, PATCH|DELETE /modules/{id}Module CRUD.
POST /modules/{id}/lessons, PATCH|DELETE /lessons/{id}Lesson CRUD (title, block content, status, preview, drip step).
POST /courses/{id}/reorderReorder modules/lessons.
GET|POST /courses/{id}/cohorts, PATCH|DELETE /cohorts/{id}Cohort CRUD and scheduling.
GET /progress/{course_id}The current member’s progress summary.
POST /progress/completeMark a lesson complete — self, or another member with gg_manage_enrollments. Takes media_blocks and claimed_interactive_blocks (block ids) for lessons with a watch gate or a gated interactive block.
GET /interactive-widgetsThe registered interactive widgets (label, description, provider, option schema, can_complete) for the builder’s picker. gg_manage_courses; Professional.
GET /quizzes/{id}/clip/{token}Streams one listening clip (with Range support) for the current member’s open attempt. The token is per member, per attempt and per clip, so it stops working once the attempt is submitted.
GET|POST|PATCH|DELETE quiz routesQuiz + question authoring (/lessons/{id}/quiz, /quizzes/{id}, /quizzes/{id}/questions…), and POST /quizzes/{id}/submit for attempts.
GET /import/learndash/dry-run, POST /import/learndash, GET /import/learndash/status/{run_id}The migrator.

Interactive widgets

The registry behind the Interactive block lives in Gather Grove core (GatherGroveCoreInteractive, core 0.72.0+), so any plugin can add a widget and any page can show one. A widget is script handles plus an option schema: the registry accepts no inline JavaScript and no URLs.

add_action( 'gather_grove/interactive/register', function ( $registry ) {
	$registry->register( 'acme/tuner', array(
		'label'        => __( 'Tuner', 'acme' ),
		'description'  => __( 'Match the reference pitch.', 'acme' ),
		'provider'     => 'Acme',
		'script'       => 'acme-tuner',   // a handle you registered with wp_register_script()
		'style'        => 'acme-widgets', // optional
		'options'      => array(
			'note' => array( 'type' => 'note', 'label' => __( 'Reference', 'acme' ), 'default' => 'A4' ),
		),
		'can_complete' => true,  // may signal completion
		'has_state'    => false, // saves progress through api.state
		'fallback'     => __( 'A tuner. Enable JavaScript to use it.', 'acme' ),
	) );
} );

Option types: number (min, max, step), select (choices), bool, text (up to 200 characters), html (short rich text, up to 2,000), note (a note name such as C#4), list (up to 16 numbers, texts or notes), attachment (media image or audio; stored as an id), and items (a repeater of rows whose fields use any type except list and items; max up to 50). Every type takes label, help and default. A stored config is capped at 32 KB, and the builder generates its settings form from this schema.

In the browser, your script defines the widget; script order doesn’t matter:

window.ggInteractive.define( 'acme/tuner', function ( mount, config, api ) {
	// config: the saved settings; attachments arrive as { id, url, alt, mime }
	// api.complete( evidence ) — signal completion (once)
	// api.audio()   — the page's one shared AudioContext; start sound only from a click
	// api.tokens()  — the studio's resolved design tokens, for drawing on a canvas
	// api.state.get() / api.state.set( obj ) — progress saved to the member's account
	// api.reducedMotion, api.loginHint
	return { destroy: function () {} };
} );

Completion bubbles as the DOM event gg:interactive:complete (detail: { widget, block, evidence }). Theme with the GG tokens; hard-coded colors don’t follow a studio’s brand or dark mode.

Hooks: gather_grove/interactive/config (filter: $config, $slug, $args, the last change before render) and gather_grove/interactive/rendered (action: $slug, $surface, $args).

Saved progress goes through GET|PUT gather-grove/core/v1/widget-state, for the current user only, with a context the renderer signed (a lesson block is lesson:{lesson id}:{block id}). Each state is up to 8 KB, each member keeps up to 500, and the data is in WordPress’s personal-data export and erase tools.

Editing surfaces: the block gather-grove/interactive (attributes widget, config, caption, instance) and the Elementor widget gg_interactive (control ids {slug with _}__{option}, e.g. gg_flashcards__cards) both render through the same renderer. POST gather-grove/core/v1/interactive/preview (edit_posts) returns { html } for { widget, config, caption } with media resolved and nothing saved; load the runtime and widget scripts with GatherGroveCoreInteractiveAssets::enqueue_all() and mount the markup with ggInteractive.mount( el ).

Shortcode: . Every other attribute is an option, validated like a lesson’s config; list options are comma-separated, and items come from a JSON config attribute (a named attribute wins over the same key in it). id keys the reader’s saved progress; without it the key is a hash of the widget and its settings, never its position on the page.

The media player

The audio and video player lives in Gather Grove core (GatherGroveCorePlayer, core 0.74.0), so every plugin and page uses the same one. PlayerRenderer::render( $url, 'video'|'audio', $opts ) returns the markup: our element with native controls as the no-JS floor for a direct file, or the provider’s iframe for YouTube or Vimeo. PlayerAssets::enqueue() loads gg-player (script and style). The script announces gg:player:mount on each element once its controls are in place; Courses layers the lesson’s resume position and watch gate on the element’s own media events. Shortcodes: and . The Elementor gg_video_player and gg_audio_player widgets register while gather_grove/player/elementor_widgets is true.

Wording

Courses registers its member-facing nouns — course, module, lesson, cohort — with core’s shared vocabulary registry (GatherGroveCoreVocabularyVocabulary), and member too when Communities hasn’t already. Any plugin can read them with Vocabulary::singular( 'course' ) / plural(); a studio’s words are stored in the gg_vocabulary_terms option (course_singular, course_plural, …), and the gather_grove/vocabulary/term filter has the last word.

Courses also answers Booking’s gather_grove/booking/account_menu_items filter with a my_courses row (label “My {Courses}”, URL = Booking’s My Account page + #library) for members with an active enrollment. It is placed after the my_account row, skipped when any row already points at that URL, and switched off by the gather_grove_courses_general → account_menu_my_courses setting ('0').

Merging duplicate members

Before a Gather Grove plugin (Pulse) folds a duplicate account into another and deletes it, it asks every plugin that keeps per-member data whether the duplicate holds any. Courses answers both suite-wide filters:

  • gather_grove/member/merge_blockers ( $blockers, $duplicate_id, $keeper_id ) (WordPress user ids) — Courses appends one { plugin: 'gather-grove-courses', code, message, reverse } entry for each kind of course record the duplicate holds. Codes: course_enrollments (including removed ones, which can be restored), cohort_places, lesson_progress, quiz_attempts, certificates, library_access, lesson_notes, watch_progress, course_applications (an approved application still waiting for its enrollment), teaches_courses (instructor of record), and could_not_check when a read fails. reverse is true when the other account holds no course records, so merging the other way round would keep everything. Asking changes nothing.
  • gather_grove/member/merge_responders ( $slugs ) — Courses adds gather-grove-courses, so the asking plugin can tell an account with nothing here from a Courses version that does not answer.

Courses cannot move course records from one account to another, so an account that holds any is never deleted by a merge.

Read Courses data from another plugin

Use the public facade, never the tables: GatherGroveCoursesPublicApiCohorts::active_member_ids( $cohort_id ) returns a cohort’s active roster and degrades to an empty list when Courses isn’t booted. (This is what Communities uses to seed a cohort space.)

Licensing tiers on dev sites

Licensing is live. The Freemius SDK is initialized from the main plugin file and handed to the licensing broker before plugins_loaded, so every install resolves an SDK-backed provider and the Pro gates are enforced on the server against a real license. (Earlier releases shipped the SDK wired but dormant, with every install reporting the full Lifetime Professional tier — that is no longer the case. See Free vs Pro for what each tier includes.)

Two escape hatches remain for development. Define GATHER_GROVE_COURSES_FORCE_FREE truthy in wp-config.php to exercise the free tier and see exactly what a non-paying site gets. In tests, set InterimLicenseProvider::$plan_override to a LicenseProvider::PLAN_* constant and reset it in tear-down. Neither changes what FeatureGate or any call site does — the gate reads whatever the provider reports.

One detail worth designing around: keys outside FeatureGate‘s Pro list short-circuit to true, so the free-tier baseline (the course builder, the lesson player, the LearnDash migrator, the Course Card widget) never reaches has_feature() at all.


Applies to Gather Grove Courses v1.52.0. Last synced November 6, 2026.