learndash_show_next_link

apply_filters( 'learndash_show_next_link',  boolean $show_previous_link,  int $course_step_post,  int $course_id,  int $user_id )

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


Description #


Parameters #

$show_previous_link

(boolean) Whether to show parent previous link.

$course_step_post

(int) ID of the lesson/topic post.

$course_id

(int) Course ID.

$user_id

(int) User ID.


Source #

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


Examples #

 <?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;
}