Browse: Home / Hooks /

learndash_show_next_link

apply_filters( 'learndash_show_next_link',  bool $show_next_link,  int $user_id,  int $step_id )

Filters whether to show the next link in the course navigation.


Description #

This filter is not applied in the LD30 Modern mode. If you want to hide the next link in LD30 Modern mode, use the hooks available in the LearnDash\Core\Template class.


Parameters #

$show_next_link

(bool) Whether to show next link.

$user_id

(int) User ID.

$step_id

(int) ID of the lesson/topic post.


Return #

(bool)


Source #

File: themes/ld30/templates/modules/course-steps.php


Examples #

Note: Extended code example below not guaranteed, you may need to consult with a developer

 <?php
/**
 * Example usage for learndash_show_next_link filter.
 */
add_filter( 'learndash_show_next_link', 'learndash_show_next_link_proc', 10, 3 );
function learndash_show_next_link_proc( $show_next_link = false, $user_id = 0, $post_id = 0 ) {
	// Example 1) Check if user is admin or group_leader
	if ( ( user_can( $user_id, 'administrator' ) ) || ( user_can( $user_id, 'group_leader' ) ) ) {
		$show_next_link = true;
	}

	// Example 2) Check post type
	// $post_type = get_post_type( $post_id );
	// if ( $post_type == 'sfwd-lessons')
	// $show_next_link = true;

	return $show_next_link;
}
 

Changelog #

Changelog
Version Description
2.3.0 Introduced.