Browse: Home / Hooks /

learndash-lesson-can-complete

apply_filters( 'learndash-lesson-can-complete',  boolean $can_complete,  int $post_id,  int $course_id,  int $user_id )

Filters whether a user can complete the lesson or not.


Description #


Parameters #

$can_complete

(boolean) Whether user can complete lesson or not.

$post_id

(int) Lesson ID/Topic ID.

$course_id

(int) Course ID.

$user_id

(int) User ID.


Source #

File: themes/ld30/templates/lesson.php


Examples #

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

 <?php
/**
 * Example usage for learndash-lesson-can-complete filter.
 */
add_filter(
	'learndash-lesson-can-complete',
	function( $can_complete, $post_id, $course_id, $user_id ) {
		// May add any custom logic using $can_complete, $post_id, $course_id, $user_id.

		// Always return $can_complete.
		return $can_complete;
	},
	10,
	4
);
 

Changelog #

Changelog
Version Description
3.0.0 Introduced.