Skip to content

Instantly share code, notes, and snippets.

@codeiscode-dev
Created February 12, 2018 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeiscode-dev/293f1cd9d62ea84373fb59870c8c3555 to your computer and use it in GitHub Desktop.
Save codeiscode-dev/293f1cd9d62ea84373fb59870c8c3555 to your computer and use it in GitHub Desktop.
WPEP Frontend Course Events List
<?php
/* Course Lesson Completed
* $lesson_id <- Lesson ID, from the WPEP Lesson Table
* $is_completed <- true/false
* $user_id <- the User that has completed the lesson, this is also triggered if it's 0
*/
do_action( "wpep_user_activity_lesson_status", $lesson_id, $is_completed, $user_id );
// How to Get The Course ID From the Lesson ID
$lesson_id = \WPEP\Entity\Course::instance()->get_course_id_by_lesson_id( $lesson_id );
// How to Get The Lesson ( post_id / course_id is available inside )
$lesson = \WPEP\Entity\Course::instance()->get_lesson( $lesson_id );
/* Course Lesson Completed
* $course_id
* $section_id <- Lesson ID, from the WPEP Lesson Table
* $learning_path_index <- numeric 0 -> N
* $user_id <- logged in only
*/
do_action( "wpep_user_set_section_learning_path", $course_id, $section_id, $learning_path_index, $user_id );
// How to Get The Section by ID
$section = \WPEP\Entity\Course::instance()->get_section( $section_id );
/* WPEP Course 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 $course_id <- the course ID for which this data belongs ( always present )
* INT $section_id <- the section id for which this data belongs ( sometimes available )
* INT $lesson_id <- the lesson id for which this data belongs ( sometimes available )
* Object $existent_entry <- if this is an update of data, the existent_entry was the previous data
*/
do_action( "wpep_user_set_course_data", $key, $value, $course_id, $section_id, $lesson_id, $user_id, $existent_entry );
// Key List for Course Data ( please avoid to define them, we allow it if required )
// WPEP_USER_COURSE_STARTED <- INT time() when the course has started
// WPEP_USER_COURSE_PROGRESS <- FLOAT % of course completion
// WPEP_USER_COURSE_LATEST_INTERACTION <- Last Lesson Completed, or Learning Path Selected
// WPEP_USER_COURSE_COMPLETED <- INT|BOOL 0 or 1 if the course status is completed, we initially flag an 0.
// WPEP_USER_COURSE_COMPLETED_AT <- INT time() when the course was completed
// WPEP_USER_COURSE_IS_BOOKMARKED <- INT|BOOL 0 or 1 if the course has been bookmarked, users may not have an value set, if they never bookmarked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment