Below are the available Hooks within Courses. These can be used to customize the functionality for Courses.
Filters and Actions can be setup using these Hooks.
==========
/**
* Fires after successfully marking a course/module/lesson completed
*
* @param integer $userid User Id
* @param integer $content_id Course/Module/Lesson Post Id
* @param string $post_type Course/Module/Lesson Post Type
*/
do_action( ‘wlcourses_contents_marked_completed', $userid, $content_id, $post->post_type );
/**
* Fires after successfully marking a course/module/lesson incomplete
*
* @param integer $userid User Id
* @param integer $content_id Course/Module/Lesson Post Id
* @param string $post_type Course/Module/Lesson Post Type
*/
do_action( ‘wlcourses_contents_marked_incomplete', $userid, $content_id, $post->post_type );
/**
* Fires after a successful course duplication
*
* @param integer $new_course_id New Course ID.
* @param integer $course_id Original Course ID.
*/
do_action( ‘wishlistcourses_course_duplicated', $new_course_id, $course_id );
/**
* Fires after a successful module duplication
*
* @param integer $new_module_id New Module ID.
* @param integer $module_id Original Module ID.
*/
do_action( ‘wishlistcourses_module_duplicated', $new_module_id, $module->ID );
/**
* Fires after a successful lesson duplication
*
* @param integer $new_lesson_id New Lesson ID.
* @param integer $lesson_id Original Lesson ID.
*/
do_action( ‘wishlistcourses_lesson_duplicated', $new_lesson_id, $lesson->ID );
/**
* Fires after a successful resource duplication
*
* @param integer $new_resource_id New Resource ID.
* @param integer $resource_id Original Resource ID.
*/
do_action( ‘wishlistcourses_resource_duplicated', $new_resource_id, $resource->ID );
Triggers
/**
* Trigger action when a lesson is added
*
* @param int $post_id The Post ID of the added Lesson.
* @param int $post_parent The Parent ID of the added Lesson.
*/
do_action( ‘wishlistcourses_builder_add_lesson', $post_id, $lesson_data[‘post_parent'] );
/**
* Trigger action when a lesson is deleted
*
* @param int $post_id The Post ID of the deleted Lesson.
*/
do_action( ‘wishlistcourses_builder_delete_lesson', $id );
/**
* Trigger action when a module is added
*
* @param int $post_id The Post ID of the added Module.
* @param int $post_parent The Parent ID of the added Module.
*/
do_action( ‘wishlistcourses_builder_add_module', $post_id, $module_data[‘post_parent'] );
/**
* Trigger actions after loading Courses assets
*
* @param bool $load_assets whether to load assets or not
*/
do_action( ‘wishlistcourses_after_load_assets', $load_assets );
/**
* Trigger action before the lesson listing in course page
*
* @param $module_id Module Post ID
*/
do_action( ‘wishlistcourses_frontend_course_dashboard_before_lesson_listings', $module->ID );
/**
* Trigger actions before each lesson item is listed in course page
*
* @param $module_id Lesson's parent Module Post ID
*/
do_action( ‘wishlistcourses_frontend_course_dashboard_before_lesson_list', $module->ID );
/**
* Trigger actions after each lesson item is listed in course page
*
* @param int $lesson_id Lesson Post Id
* @param int $post_parent Lesson parent Post Id
*/
do_action( ‘wishlistcourses_frontend_course_dashboard_after_lesson_list', $lesson->ID, $lesson->post_parent );
/**
* Trigger action on the Course progress area below the lessons tracker in course page
*
* @param $module_id Module Post Id
*/
do_action( ‘wishlistcourses_frontend_course_dashboard_progress_tracker', get_the_ID() );
/**
* Trigger action after displaying the progress of lessons in lesson page
*
* @param $module_id Module Post Id
*/
do_action( ‘wishlistcourses_frontend_lessons_page_progress_tracker', $module_id );
/**
* Trigger action before the lesson listings in lesson page
*
* @param $module_id Module Post Id
*/
do_action( ‘wishlistcourses_frontend_lessons_page_before_lesson_listings', $module_id );
/**
* Trigger actions before each lesson item is listed in lesson page
*
* @param int $lesson_id Post Id of Lesson
* @param int $post_parent Post Id of Lesson's parent
*/
do_action( ‘wishlistcourses_frontend_lessons_page_before_lesson_list', $lesson->ID, $module_id );
/**
* Trigger actions after each lesson item is listed in lesson page
*
* @param int $lesson_id Post Id of Lesson
* @param int $post_parent Post Id of Lesson's parent module
*/
do_action( ‘wishlistcourses_frontend_lessons_page_after_lesson_list', $lesson->ID, $lesson->post_parent );
/**
* Trigger action before the lesson listings in module page
*
* @param int $module_id Post Id of Module
*/
do_action( ‘wishlistcourses_frontend_modules_dashboard_before_lesson_listings', $module_id );
/**
* Trigger actions before each lesson item is listed in module page
*
* @param int $module_id Post Id of Module
*/
do_action( ‘wishlistcourses_frontend_modules_dashboard_before_lesson_list', $module_id );
/**
* Trigger actions after each lesson item is listed in module page
*
* @param int $lesson_id Post Id of Lesson
* @param int $post_parent Post Id of Lesson's parent
*/
do_action( ‘wishlistcourses_frontend_modules_dashboard_after_lesson_list', $lesson->ID, $lesson->post_parent );
/**
* Trigger action on the Course progress area below the lessons tracker in module page
*
* @param int $module_id Post Id of module
*/
do_action( ‘wishlistcourses_frontend_modules_dashboard_progress_tracker', $module_id );
/**
* Trigger actions inside course tabs before displaying each tab list in course builder
*
* @param int $courseid Post Id of the course
*/
do_action( ‘wishlistcourses_builder_before_inside_course_tabs', $courseid );
/**
* Trigger actions inside course tabs after displaying each tab list in course builder
*
* @param int $courseid Post Id of the course
*/
do_action( ‘wishlistcourses_builder_after_inside_course_tabs', $courseid );
/**
* Trigger actions inside course tab contents before including each tab contents in course builder
*
* @param int $courseid Post Id of the course
*/
do_action( ‘wishlistcourses_builder_before_inside_course_tab_contents', $courseid );
/**
* Trigger actions inside course tab contents after including each tab contents in course builder
*
* @param int $courseid Post Id of the course
*/
do_action( ‘wishlistcourses_builder_after_inside_course_tab_contents', $courseid );
/**
* Trigger actions after the modules list page in course builder
*
* @param int $courseid Post Id of the course
*/
do_action( ‘wishlistcourses_builder_after_module_list_page', $courseid );
/**
* Trigger actions before the modules are listed in course builder
*
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_module_list', $courseid );
/**
* Trigger actions before each module item is listed in course builder
*
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_module_item', $item->ID, $courseid );
/**
* Trigger actions before the lessons are listed in course builder
*
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_lessons_list', $item->ID, $courseid );
/**
* Trigger actions before each lesson item is listed in course builder
*
* @param int $lesson_id Post Id of lesson
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_lesson_item', $lesson->ID, $item->ID, $courseid );]
/**
* Trigger actions after each lesson item is listed in course builder
*
* @param int $lesson_id Post Id of lesson
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_after_lesson_item', $lesson->ID, $item->ID, $courseid );
/**
* Trigger actions after the lessons are listed in course builder
*
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_after_lessons_list', $item->ID, $courseid );
/**
* Trigger actions before add lesson button in course builder
*
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_add_lesson_button', $item->ID, $courseid );
/**
* Trigger actions after add lesson button in course builder
*
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_after_add_lesson_button', $item->ID, $courseid );
/**
* Trigger actions after each module item is listed in course builder
*
* @param int $module_id Post Id of module
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_module_item', $item->ID, $courseid );
/**
* Trigger actions after the modules are listed in course builder
*
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_after_module_list', $courseid );
/**
* Trigger actions before add module button in course builder
*
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_before_add_module_button', $courseid );
/**
* Trigger actions after add module button in course builder
*
* @param int $courseid Post Id of course
*/
do_action( ‘wishlistcourses_builder_after_add_module_button', $courseid );
Filters
/**
* Filters for all the courses
*
* @param array $courses Array of course object
*/
$courses = apply_filters( ‘wishlistcourses_courses', $courses );
/**
* Filters all the course modules
*
* @param array $modules Array of modules object
* @param int $courseid Post Id of course
*/
$modules = apply_filters( ‘wishlistcourses_course_modules', $modules, $course_id );
/**
* Filters the lessons being sorted.
*
* @param array $lessons Array of lessons being sorted.
* @param int $moduleid Post Id of lessons parent module
*/
$lessons = apply_filters( ‘wishlistcourse_ajax_reorder_lessons', $lessons, $moduleid );
/**
* Filters for the current lesson id
*
* @param int $lesson_id Post Id of the current lesson
*/
$lesson_id = apply_filters( ‘wishlistcourses_current_lesson_id', $lesson_id );
/**
* Filters the next lesson
*
* @param array $next_lesson Array of post data for next lesson
* @param int $lesson_id Post Id of the current lesson
*/
$next_lesson = apply_filters( ‘wishlistcourses_next_lesson', $next_lesson , $lesson_id );
/**
* Filters the previous lesson
*
* @param array $previous_lesson Array of post data for previous lesson
* @param int $lesson_id Post Id of the current lesson
*/
$previous_lesson = apply_filters( ‘wishlistcourses_previous_lesson', $previous_lesson , $lesson_id );
/**
* Filters the lessons of a module
*
* @param array $module_lessons Array of lesson object
* @param int $module_id Post Id of the module
*/
$module_lessons = apply_filters( ‘wishlistcourses_module_lessons', $module_lessons, $module_id );
/**
* Filters for loading CourseCure assets or not
*
* @param bool $load_assets Whether to load assets or not
*/
$load_assets = apply_filters( ‘wishlistcourses_load_assets', $load_assets );
/**
* Filters the total lessons count of a course to be used for the percentage progress bar in course page
*
* @param int $course_lessons_count Course lesson count
* @param int $courseid Post Id of course
*/
$course_lessons_count = apply_filters( ‘wishlistcourses_frontend_course_dashboard_total_items_count', $course_lessons_count, get_the_ID() );
/**
* Filters the completed lessons in course page
*
* @param array $complete_course_lessons Array of lesson IDs that has been marked completed.
* @param int $courseid Post Id of course
*/
$complete_course_lessons = apply_filters( ‘wishlistcourses_frontend_course_dashboard_total_completed_items', $complete_course_lessons, get_the_ID() );
/**
* Filters the total lesson count to be used for the percentage progress bar in lesson page
*
* @param int $module_lesson_count Current count of the module's lessons.
* @param int $module_id Post Id of module
*/
$module_lesson_count = apply_filters( ‘wishlistcourses_frontend_lesson_page_total_items_count', $module_lesson_count, $module_id );
/**
* Filters the total completed lessons to be used for the percentage progress bar in lesson page
*
* @param array $complete_module_lesson Array of lesson IDs that has been marked completed.
* @param int $module_id Post Id of module
*/
$complete_module_lesson = apply_filters( ‘wishlistcourses_frontend_lesson_page_total_completed_items', $complete_module_lesson, $module_id );
/**
* Filter for showing the progress (eg. LESSON 2/5 ) in lesson page.
*
* @param $lesson_out_of_html HTML code to output
* @param $lesson_id Post Id of the current lesson
* @param $module_id Post Id of module
*/
$lesson_out_of_html = apply_filters( ‘wishlistcourses_frontend_lessons_page_lesson_out_of', $lesson_out_of_html, get_the_ID(), $module_id );
/**
* Filter for showing the Previous Link in lesson page
*
* @param $previous_lesson_html HTML code to output.
* @param $lesson_id Post Id of the current Lesson.
* @param $previous_lesson_id Post Id of the previous Lesson.
*/
$previous_lesson_html = apply_filters( ‘wishlistcourses_frontend_lessons_page_previous_link', $previous_lesson_html, $lesson_id, $previous_lesson->ID );
/**
* Filter for showing Mark as Completed button in lesson page
*
* @param string $complete_marker_html HTML code to output.
* @param int $lesson_id Post Id of the current lesson.
* @param int $user_id Id of the user currently logged in
*/
$complete_marker_html = apply_filters( ‘wishlistcourses_frontend_lessons_page_complete_marker', $complete_marker_html, $lesson_id, $user_id );
/**
* Filter for showing the Next Link in lesson page
*
* @param string $next_lesson_html HTML code to output.
* @param int $lesson_id Post Id of the current Lesson.
* @param int $next_lesson_id Post Id of the next Lesson.
* @param int $module_id Post Id of the module
*/
$next_lesson_html = apply_filters( ‘wishlistcourses_frontend_lessons_page_next_link', $next_lesson_html, $lesson_id, $next_lesson->ID, $module_id );
/**
* Filter module's lesson count in lesson page
*
* @param int $cnt Module's lesson count
*/
$lesson_count = apply_filters( ‘wishlistcourses_module_lessons_count', count( $lessons ) );
/**
* Filters the total lesson count in a module to be used for the percentage progress bar in module page
*
* @param int $module_lesson_count Count of the module's lessons
* @param int $module_id Post Id of module
*/
$module_lesson_count = apply_filters( ‘wishlistcourses_frontend_modules_dashboard_total_items_count', $module_lesson_count, $module_id );
/**
* Filters the total completed lesson count in a module to be used for the percentage progress bar in module page
*
* @param array $complete_module_lesson – Array of lesson IDs that has been marked completed.
* @param int $module_id Post Id of module
*/
$complete_module_lesson = apply_filters( ‘wishlistcourses_frontend_modules_dashboard_total_completed_items', $complete_module_lesson, $module_id );
/**
* Filter if the user has access to the content
*
* @param bool $has_access If user has access or not
* @param int $user_id ID of the user
* @param int $post_id ID of the post
* @param string $post_type The post type
* @param int $courseid ID of the course
*/
$has_access = apply_filters( ‘wishlistcourses_member_can_access_content', $has_access, $user_id, $post_id, $post_type , $courseid );
/**
* Filter if the user has linear access to the content
*
* @param bool $linear_access If user has access or not
* @param int $user_id ID of the user
* @param int $post_id ID of the post
* @param int $prev_lesson_id ID of the previous post
* @param int $courseid ID of the course
* @param string $post_type The post type
*/
$linear_access = apply_filters( ‘wishlistcourses_has_linear_access', $linear_access, $user_id, $post_id, $prev_lesson_id, $courseid, $post_type );
/**
* Filter checking if lesson is a preview
*
* @param bool $has_access If user has access or not
* @param int $user_id ID of the user
* @param int $post_id ID of the post
* @param int $courseid ID of the course
*/
$in_preview = apply_filters( ‘wishlistcourses_is_lesson_preview', $in_preview, $user_id, $post_id , $courseid );
/**
* Filters the access tabs in course builder
*
* @param array $access_tabs Associative array of ‘tab id' => ‘tab label' access tabs.
*/
$access_tabs = apply_filters( ‘wishlistcourses_course_builder_access_tabs', $access_tabs );
/**
* Filters the access tab panels in course builder
*
* @param array $access_panels Array of tab panel PHP files to include.
*/
$access_panels = apply_filters( ‘wishlistcourses_course_builder_access_panels', $access_panels );
—
More info on Hooks can be found in the following articles:
Hooks – Badges
Hooks – Quizzes
Hooks – Points
—