llms_is_quiz_accessible( int $post_id, $user_id = null )
Determine if a quiz should be accessible by a user
Description Description
Parameters Parameters
- $post_id
-
(int) (Required) WP Post ID
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
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.1.6 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: