Skip to content

Helper Functions

The addon defines a set of global helper functions (all prefixed reign_lifterlms_) used by its templates. They are available to theme developers building custom LifterLMS views on a Reign site. Each takes a course ID unless noted.

Function Returns
reign_lifterlms_locate_template( $name, $path, $default ) Resolved template path, respecting theme overrides.
reign_lifterlms_get_template( $name, $args, $path, $default ) Locates and includes a template with $args in scope.
Function Returns
reign_lifterlms_is_assignment_associated( $course_id ) “Yes”/“No” whether any lesson has an assignment (needs the LifterLMS Assignments add-on).
reign_lifterlms_is_certificate_associated( $course_id ) “Yes”/“No” whether a certificate engagement is tied to the course or its lessons.
reign_lifterlms_get_course_review_count( $course_id ) Published review count for a course.
reign_lifterlms_get_course_reviews_analytics( $course_id ) Array of total reviews, average, per-star breakdown and percentage.
reign_lifterlms_get_course_price( $course_id ) Price HTML, using WooCommerce product prices when the LifterLMS WooCommerce integration is enabled, otherwise LifterLMS access-plan prices.
reign_lifterlms_progress_course( $course_id ) Current user’s completion percentage for a course.
reign_lifterlms_course_data_tabs() The single-course tab definitions (filterable via reign_lifterlms_course_data_tabs).
reign_lifterlms_get_lesson_list_for_course( $course_id ) A <select> of the course’s accessible lessons (for the distraction-free lesson picker).
Function Returns
reign_lifterlms_get_author( $args ) Author block HTML (avatar, name, optional bio).
reign_lifterlms_get_user_link( $author_id ) Best profile URL (Social Learning, then BuddyPress, then author archive).
reign_lifterlms_get_course_search_form( $echo ) Course-scoped search form.
reign_lifterlms_get_default_course_img_url() URL of the bundled default course image.
reign_lifterlms_default_course_img_html() <img> for the default course image.
reign_lifterlms_allowed_html_tags() The wp_kses allow-list used for settings markup.

These wrap LifterLMS methods that changed across versions, so templates keep working across releases:

Function Purpose
reign_lifterlms_get_parent_course( $lesson ) Parent course ID (handles the pre/post 5.7.0 API).
reign_lifterlms_get_lesson_order( $lesson ) Lesson order (handles the pre/post 5.7.0 API).
reign_lifterlms_get_quiz_result( $query ) Quiz attempt results (handles the pre/post 6.0.0 API).

Behavioural helpers (hooked automatically)

Section titled “Behavioural helpers (hooked automatically)”
  • reign_lifterlms_body_classes adds llms-pointer and the dashboard-navigation style class to body.
  • reign_lifterlms_remove_sidebar_from_single_course hides the sidebar on single courses.
  • reign_lifterlms_remove_single_course_customizer_setting removes the theme’s single-course layout Customizer controls (the addon owns that layout).
  • reign_lifterlms_all_users_course_tab_option_save / reign_lifterlms_users_default_option_save seed the per-user course-tab and activity opt-in defaults (using the course_tab_flag option and user_course_option / activity user meta).