Skip to content

Every action and filter the add-on fires. All names start with reign_ld_ unless noted.

Action Arguments When
reign_ld_loaded none LearnDash 5.2 and Reign 8.1.0 are present and the add-on has started.
reign_ld_before_{part} array $data Before a template part prints. See Template overrides.
reign_ld_after_{part} array $data After a template part prints.

Parts: archive_instructor, archive_grid, archive_filters, card_course, card_group, course_related, community_profile_courses.

Filter Arguments Returns
reign_ld_default_settings array $defaults Defaults for every setting, keyed by setting name.
reign_ld_course_template string $template, int $course_id reign, classic, spotlight or academy.
reign_ld_course_sections array $sections, string $template, Reign_Course_Adapter $adapter Course page sections after the template arrangement. Array shape is the theme’s reign_course_layout_sections.
reign_ld_archive_layout string $layout reign, classic, soft or catalog.
reign_ld_grid_atts array $atts, string $type Grid attributes after defaults. $type is courses or groups.
reign_ld_card_data array $data, int $course_id Values one course card prints.
reign_ld_group_card_data array $data, int $group_id Values one group card prints.
reign_ld_{part}_data array $data Values a template part receives.
reign_ld_locate_template string $path, string $part Full path of the template file.
reign_ld_buy_button string $button, int $course, string $checkout Closed course button HTML. $checkout is empty when your own link was kept.
reign_ld_courses_tab_visible bool $visible, int $profile_user_id, int $viewer_id false hides a member’s Courses tab (menu item and page) from that viewer.
reign_ld_skip_activity bool $skip, string $event, int $user_id, int $course, int $item true to skip one activity post.
reign_ld_widget_course_args array $query, array $instance get_posts() arguments for the course list widget. Count is capped at 20.
reign_ld_instructor_roles string[] $roles Role names that count as an instructor role. Default wdm_instructor, ld_instructor. With one of these roles the add-on says “Instructor”; otherwise it says “Course author”.
reign_ld_feature_icons array $icons Icon name to label list in the course features editor.
widget_ld_course_categories_args array $args, array $instance wp_list_categories() arguments for the categories widget.

Notes:

  • $event in reign_ld_skip_activity is one of enrolled, course_done, lesson_done, topic_done, quiz_passed, quiz_failed, course_comment, lesson_comment. $item is the lesson, topic or quiz ID, or 0.
  • In reign_ld_default_settings, setting names match the fields on the settings screen, such as archive_layout and card_fields.
  • reign_ld_course_sections section keys come from the theme. The add-on adds related and category.
  • With the Reign default archive layout, course cards in the add-on’s grids are the theme’s card, so reign_ld_before_card_course, reign_ld_after_card_course and reign_ld_card_data do not run for them. Use the theme’s reign_learndash_course_card_parts (which parts show) and reign_learndash_course_card_user (whose view the card is drawn for; 0 is a visitor) filters instead.

5.2.0 is modern only. The old names are not kept as aliases.

Removed Replacement
LearnMate_LearnDash_Addon class None. Do not call the add-on’s classes. Use the hooks above.
learnmate_* filters Removed, no direct replacement. Use the reign_ld_* filters above.
wb_ld_course_review_* review hooks None. Reviews are LearnDash’s own. Use LearnDash’s review hooks.

Use the action that fires after the card.

add_action( 'reign_ld_after_card_course', function ( $data ) {
if ( ! empty( $data['id'] ) && has_term( 'beginner', 'ld_course_tag', $data['id'] ) ) {
echo '<p class="my-card-note">Good for beginners</p>';
}
} );

Use the card data filter. This renames the button for visitors with no access.

add_filter( 'reign_ld_card_data', function ( $data, $course_id ) {
if ( '' === $data['status'] ) {
$data['button'] = __( 'See what is inside', 'my-textdomain' );
}
return $data;
}, 10, 2 );
Section titled “Remove the related courses section from Academy”

Use the sections filter.

add_filter( 'reign_ld_course_sections', function ( $sections, $template ) {
if ( 'academy' === $template ) {
unset( $sections['related'] );
}
return $sections;
}, 10, 2 );
add_filter( 'reign_ld_skip_activity', function ( $skip, $event, $user_id, $course ) {
return $skip || 42 === (int) $course;
}, 10, 4 );

Use the defaults filter. A value the owner saved on the settings screen still wins, so this only changes what a new site starts with.

add_filter( 'reign_ld_default_settings', function ( $defaults ) {
$defaults['related_title'] = 'You may also like';
$defaults['related_count'] = 2;
return $defaults;
} );

On a site with no saved value, the course page then shows two related courses under the heading “You may also like”. Every key is listed in Settings reference.

More task-based snippets, and one full template override, are in Common changes with a few lines of code.