llms_is_quiz_accessible( int $post_id, int|null $user_id = null )
Determine if a quiz should be accessible by a user.
Parameters Parameters
- $post_id
-
(int) (Required) WP Post ID.
- $user_id
-
(int|null) (Optional) WP User ID (will use get_current_user_id() if none supplied). Default
null
.Default value: null
Return Return
(bool|int) If the post is not restricted returns false. If the post is restricted, returns the quiz id.
Source Source
File: includes/functions/llms.functions.access.php
652 653 654 655 656 657 658 659 660 661 662 663 664 | function llms_is_quiz_accessible( $post_id , $user_id = null ) { $quiz = llms_get_post( $post_id ); $lesson_id = $quiz ->get( 'lesson_id' ); // No lesson or the user is not enrolled. if ( ! $lesson_id || ! llms_is_user_enrolled( $user_id , $lesson_id ) ) { return $post_id ; } return false; } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.16.1 | Unknown. |
3.1.6 | Introduced. |