apply_filters( 'learndash_lesson_sample_access', boolean $access, integer $post_id, integer $user_id )
Filters whether to allow access to the sample lesson or not.
Contents
Description #
By default a sample lesson is available even to anonymous users. This filter will override that access. The filer ‘learndash_can_access_sample’ is also used themes/ld30/templates/lesson/partials/row.php to control visibility of the lesson and sub-steps.
Parameters #
- $access
-
(boolean) Access status true if the user can access $post_id.
- $post_id
-
(integer) Course step the user is trying to access.
- $user_id
-
(integer) User ID.
Source #
Examples #
<?php /** * Example usage for learndash_lesson_sample_access filter. */ add_filter( 'learndash_lesson_sample_access', function( $access, $post_id, $user_id ) { // May add any custom logic using $access, $post_id, $user_id. // Always return $access. return $access; }, 10, 3 );
Changelog #
Version | Description |
---|---|
3.2.0 | Introduced. |