[memb_lms_enrollment_button]

Description

Renders the enrollment button template with the user's current status (none, enrolled, completed) and unmet prerequisites when locked. Logged-out visitors see the logged-out variant.

The button posts through AJAX (admin-ajax.php) with an enrollment nonce. Renders nothing when no valid course can be resolved (course_id attribute or a current course post).

The HTML this shortcode renders comes from a template you can override in your theme. See Shortcode Templates.

Shortcode Examples

[memb_lms_enrollment_button]

Explicit course with custom label:

[memb_lms_enrollment_button course_id="123" label="Join the Course" class="btn-primary"]

Shortcode Parameters

course_id

Course ID. When 0, the current post must be a course. Default: 0.

label

Button label override. Default: '' (template default).

class

Extra CSS classes appended to the button. Default: ''.

Shortcode Attributes

Attribute Value
Conditional No
Nestable No
Accepts formatting No

Hooks

wpal/torii/sushi_lms/enrollment_button_before and enrollment_button_after (actions, course ID) wrap the button output.