Created
February 12, 2018 21:01
-
-
Save codeiscode-dev/7c3c0efe49041d446d575307ff7b8202 to your computer and use it in GitHub Desktop.
WPEP Assessment Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* WPEP Assessment User Data | |
* The same concept for Settings as Key -> Value, will be used by WPEP, but different, to optimize data queries. | |
* This event does not trigger if the previous $value has not changed during a save. | |
* STRING $key <- the key, explained bellow | |
* STRING|INT $value <- the value, explained bellow | |
* INT $post_id <- the Assessment ID for which this data belongs ( always present ) | |
* INT $question_id <- the question id for which this data belongs ( sometimes available ) | |
* INT $question_answer_id <- the question answer id, for example checkbox / select / radio field types ( sometimes available ) | |
* INT $user_id <- INT user id | |
*/ | |
do_action( "wpep_user_set_assessment_data", $key, $value, $post_id, $question_id, $question_answer_id, $user_id ); | |
// Alternative For this function | |
do_action( "wpep_user_set_assessment_data_" . $key, $value, $post_id, $question_id, $question_answer_id, $user_id ); | |
// Key List for Course Data ( please avoid to define them, we allow it if required ) | |
// Data / In-Depth ( these don't have definitions, and they'll never change regardless ) | |
// ( the following 2 fields will always have the $question_id, $question_answer_id ( if field type has it ), and $assessment_id | |
// 'is_correct' <- bool 0 | 1, answer is correct. | |
// 'answer' <- string answer inputted to an question | |
// WPEP_USER_ASSESSMENT_START_TIME <- INT time() when the assessment has started | |
// WPEP_USER_ASSESSMENT_SUBMISSION_TIME <- INT time() when the assessment has been submitted for review / completed / failed | |
// WPEP_USER_ASSESSMENT_SCORE <- INT 0 -> 100 the % of success | |
// WPEP_USER_ASSESSMENT_STATUS <- Flag of Status, string, we have definitions | |
// WPEP_USER_ASSESSMENT_STATUS_PENDING | |
// WPEP_USER_ASSESSMENT_STATUS_PENDING_REVIEW | |
// WPEP_USER_ASSESSMENT_STATUS_COMPLETED | |
// WPEP_USER_ASSESSMENT_STATUS_FAILED | |
/* Grading Before / After Event | |
* $assessment_id <- Assessment ID ( Custom Post Type ) | |
* $user_id <- the User that has is being graded | |
*/ | |
do_action( "wpep_user_assessment_before_grading", $assessment_id, $user_id ); | |
do_action( "wpep_user_assessment_after_grading", $assessment_id, $user_id ); | |
$course_id = wpep_get_assessment_course_id( $assessment_id ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment