Developer Guide

Last updated: July 29, 2019

WPLMS

This section describes the functioning of the WPLMS system. WPLMS is a complex system which works on top of several functionalities which are provided by the plugins included in the theme.

System

This section would describe how the WPLMS System works.

  • User Registration : This section is managed completely by BuddyPress and WordPress. Any page which is connected to the WP Admin - settings - buddypress - pages - registration becomes the registration page. BuddyPress overwrites this page and the content in the page is not loaded. WPLMS only adds styling to the page including the section accordion. This page is not available to logged in users (because they're already registered) and has two sections. The first one is required and asks for User name (login), password and email, the second one section is built using the fields set in the WP Admin -> Users -> User fields section.
    screenshot
    screenshot
    screenshot
  • Activation : This section is managed completely by BuddyPress. Any page which is connected to the WP Admin - settings - buddypress - pages - Activate becomes the registration page. BuddyPress overwrites this page and the content in the page is not loaded This page is not avaiable to logged in users (because they're already registered) . Upon successful registration the user gets an email with an activation link, the link is of the format : http://yoursite.com/activation-page-slug/XXXYYY in this link the XXXYYY is the activation code.
    When a user registers via BuddyPress it gets stored in the WP Signups table. The signups table also record the activation code. When a user activates his account by clicking on the activation link or entering the activation code in the activation page, it creates the user from the WP Signups table.
    screenshot
  • Directory pages (All Members, All Activity, All Courses, All Groups) : All the directory pages are pages connected at the WP Admin - settings - BuddyPress - Pages section. Any page connected here is built using BuddyPress template files and none of the WordPress content will be shown.
    For example : The course directory page is built using the wplms/course/index.php file. To overwrite this or build a new layout, you need to add the folder "course" in your child theme and add an index.php file which would overwrite the one in the parent WPLMS theme.
    screenshot
  • Member Profiles : Member profiles are BuddyPress section. The default BuddyPress templates are overridden by WPLMS from the members section. The template files are located in the WPLMS/members section. Note that the members section has a course folder in it which has the template files for the course.
    screenshot
    screenshot
  • My Courses : This section is located in User profile. Tempalte file is located at wplms/course/my-courses.php. Sub-sections include results and stats and instructing courses (for Instructors). The results and stats template files are located in the wplms/members/course/results.php and stat.php
  • Dashboards : User dashboard is built by the WPLMS Dashboards plugin. The template file is located in the wplms-dashboard/includes/templates/dashboard.php
  • Activity : This is the activity section. This section records all the activity in the site. All activity is recorded in the wp_bp_activity table and the activity meta table. Template files for the activity is located in wplms/activity folder. For user profile activity template files are located in the wplms/members/activity folder.
  • Courses : Courses are built in the LMS system and are integrated in the BuddyPress via the course module plugin. The main page is controlled via WordPress from the tempalte wplms/single-course.php whereas the sub-page templates (curriculum,members,admin) are located in the wplms/course/single folder.
  • Course Curriculum : Displays the curriculum build in the course. The course curriculum is stored as a serialized array in the post meta value of the course : vibe_course_curriculum.
  • Course Members : Displays members enrolled in a course. Every member subscribed to the course has a User meta value
  • Course Forum : Any forum connected to a course in the Course settings section becomes a course forum. The value of Forum ID is stored in a post meta vibe_forum. The Course Forum privacy can be enabled from the LMS -> Settings section.
    screenshot
  • Course Groups : Any Group conneted to a course in course settings becomes a course group. The value if the group id is stored in the post meta field vibe_group. This field contains the group id. By default all groups created in WPLMS (via front end) are assumed as private. When a user subscribes to a course she gets access to the group as well.
  • Edit Course : This section is added by the WPLMS Front end plugin. A page connected to the WPLMS - Course manager opens when user clicks on the edit course. This is course creation page, note the ?action=234 in the url. The 234 is the course id, if you remove the course id from the url and reload the create course page will open a blank course. The course is created when the user clicks on the create course button.
  • Course Admin : Displays admin actions for the course. Template file is located in the WPLMS /Course/single/admin.php

Course Functioning

This section explains how courses function in WPLMS

  • Course Purchase : A course by default has no connection with the purchase process. The process of assignment starts after the course is purchased. In case of memberships, when a course is assigned to a membership level and a user who is subscribed to the membership level opens the course the course assignment starts. For example: If a course is connected to a woocommerce product, then when the purchase for the course is finished. The course assignment starts when the order has been marked as complete, which is on the hook "woocommerce_order_status_completed". At this point the expiry point for the user purchasing the course is set. The expiry point is calculated on the product subscription (if set) or on course duration. Which equals current timestamp + the course duration/subscription duration
  • Course Subscription : When a user is subscribed to a course. Two User meta values for the user are set : courseID and course_status.courseID, courseID is numeric value of course. The value for usermeta field "courseID" is the expiry timestamp for the user. Whereas the course_stats.courseID has value of 1 which indicates course is ready to begin. A postmeta field is also set for the course with key as UserID and value as 0.
  • Course Start : When the subscribed user starts a course the Number of students in course counter increases. The course_status>courseID usermeta value is set to 2 which indicates the user has started the course. The course postmeta with key as userID is set to 1.
  • Course Statuses : Course status govern the display of the take this course button.
    Course status : 1 : START COURSE
    Course status : 2 : CONTINUE COURSE
    Course status : 3 : FINISH COURSE : COURSE UNDER EVALUATION
    Course status : 4 : COURSE EVALUATED
  • Course Submission : When course is submitted by the user the course_status.courseID user meta is set to 3
  • Course Evaluation : When course is submitted by the user the course_status.courseID user meta is set to 4
  • Badges : All badges are connected to courses and badge information is stored in course meta vibe_course_badge,vibe_course_badge_percentage,vibe_course_badge_title. The badges are stored in user meta field "badges" as a serialised array of course ids. This value is fetched in the user profile section to generate the badges for the course.
  • Certificates : All certificates are connected to courses and badge information is stored in course meta vibe_course_certificate,vibe_course_certificate_template,vibe_course_passing_percentage. The certificates are stored in user meta field "certificates" as a serialised array of course ids. This value is fetched in the user profile section to generate the certificates for the course.
  • Course Finish : When course is submitted by the user the course_status.courseID user meta is set to 4 and the postmeta field in the course is updated to marks obtained by the user in the course. These marks are shown in user results section.
  • Course Expiry : When a user is active in a course but the expiry time set for the user is less than the current timestamp. The course appears as expired for the user. The expiry time is stored in user meta field where the user key is the course id.

Plugins

Each of these plugins covers a specific area, for example, if you want to retain all the data you've created in the theme, you only need to make sure you've installed the Vibe Custom types plugin

Installed Plugins

  1. Vibe Course Module : This is the course module plugins specifically designed for WPLMS. This plugin includes most of the functionality on the front end of the LMS. The Plugin acts as a bridge between WordPress and BuddyPress and WPLMS Theme.
  2. Vibe Custom Types : This Plugin creates custom post types and custom meta boxes for WPLMS. This plugin stores all your LMS data. All the Custom post Types like: Courses, Units, Quizzes, Questions, Testimonials, and Popups.
  3. Vibe Shortcodes : This Plugin contains all the shortcodes used in the theme. The ( V ) icon is added in the WP TinyMCE editor which contains the shortcode generator. Refer the shortcodes list : Link
  4. WPLMS Dashboard : Dashboards is a one stop area for Student / Instructor to get a brief snapshot of what is happening in the site/courses. Refer the link : Tutorial
    screenshot
    screenshot
    screenshot
    screenshot
    screenshot
  5. WPLMS Assignments : Through this plugin an instructor can assign homeworks to their students. Now, Assignment can also be included in courses for course evaluation, that is when the course is evaluated the cumulative percentage of all the quizzes and assignments will be calculated for auto-eveluate courses. For manual evaluation, assignment marks will be shown along with quiz marks for grading purpose. An instructor can add assignments in units from front as well as back end.
    To create assignments : Tutorial(refer create assignments)
    screenshot
    screenshot
  6. WPLMS EventOn : WPLMS EventOn integrates EventOn plugin with WPLMS theme. It is used to add course specific events and dashboard calendar widget.

    Refer the Link to know about EventOn widgets : Tutorial

  7. WPLMS Front End : WPLMS Front End is a plugin made for WPLMS Theme. This plugin is only meant to work with WPLMS and can only be used with WPLMS. The WPLMS Front end plugin enables front end course creation and editing in WPLMS Theme. This plugin also enables front end unit creation, front end quiz creation, font end question creation.

Free ADDON

  1. BP Social Connect : Connect your BuddyPress site with popular social networks. This plugin will allow you to connect your WordPress or BuddyPress. You can now integrate bp social connect that allows user to log-in via Google,Facebook and Twitter accounts with your website.

    Refer the tutorial : BP Social Connect Integration with WPLMS

  2. WPLMS Co-Author Plus : Wplms can be integrated with co-authors plus plugin. This add on supports multiple instructors for a single course. To create multiple instructors in a course, activate co-authors plugin and edit your course in which there is a setting present to set your authors. Add multiple instructors for that course.
    screenshot
    screenshot
  3. WPLMS H5P Plugin : This Plugin is used to integrate H5P Plugin with WPLMS H5P. It works with wplms units and quizzes and integrates WPLMS quizzes with H5P quizzes. Refer the link for tutorial : WPLMS H5P AddOn
    screenshot
    screenshot
  4. WPLMS MyCred ADDON : Connect your WPLMS Learning management system with MyCred Points system plugin. It allows students to puchase courses via MyCred points. This addon plugin integrates WPLMS with MyCred points system and also adds gamification options to award points to users on certain criteria.
  5. WPLMS BadgeOS : BadgeOS is a plugin that allows your site’s users to complete tasks and earn badges. WPLMS BadgeOS integrates BadgeOS Plugin with WPLMS.
  6. WPLMS H5P Plugin : This Plugin is used to integrate H5P Plugin with WPLMS H5P. It works with wplms units and quizzes and integrates WPLMS quizzes with H5P quizzes. Refer the link for tutorial : WPLMS H5P AddOn
    screenshot
    screenshot
  7. WPLMS BigBlueButton : BigBlueButton is an open source web conferencing system. Wplms BigBlueButton Plugin integrates BigBlueButton with wplms. It adds meeting tab in profile. you can set reminders before meetings,send email notifications before meeting. Refer the link for wplms bbb addon : Tutorial
    screenshot
    screenshot
    screenshot
  8. WPLMS WooCommerce Subscriptions : WooCommerce Subscriptions allows you to introduce a variety of subscriptions for physical or virtual products and services. Create product of the month clubs, weekly service subscriptions or even yearly software billing packages. Add sign-up fees, offer free trials or set expiration periods. This Plugin integrates WooCommerce Subscriptions with WPLMS.

    Refer the Link : WPLMS Integration with WooCommerce Subscription

  9. WPLMS WooCommerce Memberships : Connects the woocommerce memberships to courses and provides access based on memberships.

    Refer the Link : WooCommerce Membership Integration

  10. WPLMS EDD(Easy Digital Downloads) Addon : Easy Digital Downloads is a complete eCommerce solution for selling digital products on WordPress. Whether it is software, documents, photos, ebooks, songs, graphics, or any other type of media file, Easy Digital Downloads provides a complete system for effortlessly selling your digital products. This addon will integrate EDD Plugin with wplms.
    Refer the link : Download WPLMS EDD Addon

Filters & Hooks

Hooks are functions that can be applied to an Action or a Filter in WordPress. Actions and Filters in WordPress are functions that can be modified by theme and plugin developers to change the default WordPress functionality. Functions used to modify Actions/Filters in WordPress can be hooked into WordPress. However, it is important to note that actions and filters are not the same thing. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions.

This section describes the filters and hooks used in the theme.

Hooks

  1. WPLMS Theme

    All WPLMS Theme Hooks are included in: wplms/includes/action.php
    • bp_before_member_body : Execute before the display of member body content.
    • wplms_certificate_before_full_content : Runs before any content on default certificate.
    • wplms_before_start_course_content : Runs before start course content.
    • wplms_before_members_directory : Runs before buddypress members directory load.
    • wplms_before_activity_directory : Executes before buddypress activity directory load.
    • wplms_before_groups_directory : Executes before buddypress groups directory load.
    • wplms_before_member_profile : Executes before single member profile view.
    • wplms_before_single_course : Runs before the single course view.
    • wplms_single_course_content_end : Runs after the single course content end. basically, you can show sidebars, bottoms after the course content ends.
    • course_action_points : Runs to disable controls on course status.
    • wplms_after_course_directory : Runs to load the content after course directory layout loads.
    • bp_before_course_header : Runs before single course page : course header (left column) is displayed.
    • wplms_customizer_custom_css : Runs in Customizer generate CSS function. Accepts the argument $themecustomizer which is an array containing all the settings in the theme customizer.
    • bp_course_header_actions : Displays header actions, like instructor message/email on single course page.
  2. Vibe Course Module

    All vibe course module hooks are included in: vibe-course-module/includes/bp-course-action.php
    • woocommerce_after_add_to_cart_button : To add content on single course page after add to cart button.
    • woocommerce_order_status_completed : Executes when woocommerce product order status completed.
    • woocommerce_order_status_cancelled : Executes when woocommerce product order status cancelled.
    • bp_members_directory_member_types : To specify whether a list of members matching a given type.
    • wplms_before_start_course : Runs at the begining of start course page before header. Usually used for access check.
    • wplms_user_course_stats : Runs to display user course stats.
      @param : $user_id
      @param : $course->ID
    • wplms_unit_header : Runs to display unit header.
      @param : $user_id
      @param : $course->ID
    • wplms_course_submission_quiz_tab_content : Runs after course submission, to display content in quiz tab.
    • wplms_course_submission_course_tab_content : Runs after course submission, to display content in course tab.
    • wplms_course_submission_applications_tab_content : Runs after course submission, to display content in application tab.
    • wplms_get_quiz_result : display quiz results.
    • wplms_get_user_results : Execute to fetch the users's quiz results.
    • wplms_quiz_results_extras : Run for quiz retakes.
      @param : $quiz_id
      @param : $user_id
      @param : $course
    • wplms_before_quiz_begining : Runs before the beginning of the quiz to check whether the questions are set or not in the quiz.
      @param : $quiz_id
    • bp_before_course_home_content : Executes to load course navigation menus before the course home content.
    • pre_get_posts : Fires after the query variable object is created, but before the actual query is run.
    • wplms_quiz_question : Executes to add "Previous Question" and Next "Question Links"
      @param : $ques_id
      @param :$quiz_id
    • wplms_before_course_main_content : Runs before the course contents load.
    • wplms_unit_content : Runs to load the unit content.
    • wplms_unit_controls : This hook loads the unit controls
    • wplms_course_action_points : After completing units, an user can finish the course or review the course.
    • wplms_load_templates : Run to load the templates.
    • wplms_after_course_button_form : @param : $user_id
      @param : $course_id
      @param : $course_user
    • wplms_course_subscribed : Executes when user is subscribed to course
      @param : $user_id
      @param : $course_id
      @param : $group_id
    • wplms_after_quiz_message : Runs after quiz message but before the quiz results.
      @param : $user_id
      @param : $quiz_id

Filters

  1. WPLMS Theme

    All wplms filters are included in: wplms/includes/filters.php
    • body_class : Runs on the class of the body of a page.
    • woocommerce_output_related_products_args : Change number of related products on product page
    • wplms_sidebar : Filter applied on sidebars, to show sidebars on a course page
    • bp_core_fetch_avatar_no_grav : filter applied when no gravatar is there
    • bp_core_default_avatar_user : Filter is applied top show a default gravatar.
    • wplms_activity_loop : Append Activity of user's
    • get_avatar : Filter is applied to display gravatar
    • widget_text : Filters the content of the Text widget.
      @param : $text(string) The widget content.
      @param :$instance(array) Array of settings for the current widget.
      @param : $this, Current Text widget instance.
    • registration_redirect : Filters the registration redirect URL.
      @param :$registration_redirect(string), the redirect destination URL.
    • comments_open : Filters whether the current post is open for comments.
      @param :$open(bool), Whether the current post is open for comments.
      @param :$post_id(int) The post ID.
    • script_loader_src : Filters the script loader source.
    • style_loader_src : Filters an enqueued style's fully-qualified URL.
      @param : $src(string) Script loader source path.
      @param :$handle(string) Script handle.
    • wplms_carousel_course_filters : Filters the carousel of courses
    • wplms_grid_course_filters : Filters the grid of courses
    • bp_course_wplms_filters : Filters Arguments passed by Filters in course directory
    • wplms_show_instructor_courses : Filter on the display of instructor courses.
    • wplms_instructor_courses_style : Filter on featured block style name (course2, course...) for instructing courses
    • wplms_certificate_code_user_id : Certificate validation, Filter on certificate code to return User ID
    • wplms_certificate_code_template_id : Certificate validation, Filter on certificate code to return Template ID
    • wplms_certificate_code_course_id : Certificate validation, Filter on certificate code to return User ID
    • vibe_option_custom_sections: Filters out sections in options panel. Can be used to add custom options or information in options panel.
    • wplms_post_metabox : Filters metabox arguments for posts
    • wplms_page_metabox : Filters metabox arguments for pages
    • wplms_course_metabox : Filters metabox arguments for courses
    • wplms_course_product_metabox : Filters metabox arguments for Course pricing options
    • wplms_unit_metabox : Filters metabox arguments for units
    • wplms_question_metabox : Filters metabox arguments for questions
    • wplms_quiz_metabox : Filters metabox arguments for quizzes
    • wplms_testimonial_metabox : Filters metabox arguments for testimonial
    • wplms_product_metabox : Filters metabox arguments for product
    • wplms_events_metabox :Filters metabox arguments for Events
    • wplms_certificate_metabox : Filters metabox arguments for certificate
    • manage_edit-course-cat_columns : Filter applied on course category columns
    • manage_course-cat_custom_column : Filter applied on course category custom columns
    • get_terms_orderby : Filter is applied to get the terms in order(descending order)
    • wplms_course_filters_course_cat : To filter course categories
      @param : $order
      @param : $sort
    • vc_settings_page_show_design_tabs : filter to show visual composer design tabs
    • bp_get_the_profile_field_value: Filter is applied to get profile field values.
      @param :
    • bp_get_profile_field_data : Filter is applied to get profile field data
      @param :$field
      @param :$user_id
    • wplms_backend_cpt_query : Filter is applied for instructor content privacy
    • wplms_site_link : Filter is applied to return home url if it is a multisite. If not, then return site url
      @param :$url
      @param :$location
    • wplms_site_lock_exclusions Filter is applied on site lock
    • bp_user_can_create_groups : Filter is applied to determine if the current logged in user can create groups.
    • wplms_enable_signup: Filter is applied on the signup.
    • wplms_buddypress_registration_link : Filter is applied on the registration link.
  2. Vibe Course Module

    All vibe course module filters are included in: vibe-course-module/includes/bp-course-filters.php
    • wplms_course_product_id : Filters Product ID for course take this course button.
    • vibe_course_duration_parameter : Filters course duration parameter
    • vibe_drip_duration_parameter: Filters drip feed duration
    • vibe_unit_duration_parameter: Filters a specific unit duration
    • vibe_quiz_duration_parameter : Filters quiz time duration
    • vibe_assignment_duration_parameter : Filters assignment time duration
    • wplms_curriculum_course_lesson : Course - Curriculum : Filters individual Unit html in Course - Curriculum. Accepts 1 more argument as Unit ID
    • wplms_unit_classes : Filters classes added in the units loaded inside the course start page.
    • wplms_take_this_course_button_label : Filters take this course button label
      Refer : Tip to change button label
    • wplms_private_course_button_label: Filters labels on Private course button
    • wplms_course_product_id : Filters Product ID for course take this course button.
      @param : Product ID
      @param : Course ID
    • wplms_private_course_button : Filters link on Private course button
    • wplms_course_details_widget : Filters course details array.
    • wplms_course_submission_tabs : Filters the submissions by the student
    • wplms_drip_feed_element_in_message : Filters the message of unit availability
    • wplms_drip_value : Filter evaluates the drip value
      @param: $value
      @param: $course_id
      @param: $units
    • vibe_total_drip_duration : Filters the total drip duration, when the course is started till the end.
    • bp_course_next_unit_access : Filters the accessibility of next unit
    • bp_activity_user_can_delete : test if a non-admin can delete their own activity.
    • bp_get_course_certificate_url : Filters the course certificate url
    • bp_get_profile_field_data : Filter the profile fields.
    • get_comment : Fires after a comment is retrieved.
    • wplms_course_locate_template : filters the course template.
    • bp_course_total_count : Returns total count of course
    • wplms_calculated_commission_base : Filters calculated commission for instructor for per course sale.
    • wplms_unit_mark_complete : Filters Mark unit complete HTML
    • wplms_in_course_quiz_args : Filters WP Query arguments for In course quiz
    • bp_course_wplms_filters : Filters Arguments passed by Filters in course directory
    • bp_user_can_create_course : Filters true/false based on current user capability
    • wplms_course_nav_menu : Filters Course Menu.
    • bp_directory_course_search_form : Filters search form HTML
    • wplms_auto_subscribe : Filters auto-subscribe (user gets subscribed to course on opening the course)for course. Accepts 1 more argument : Course ID
    • wplms_take_course_page : Filters Take course page url, accepts Course ID as another argument
    • wplms_finished_course_link : Filters finished course link when course is finished
    • wplms_course_product_id : Filters Product ID for course take this course button. Arguements : Product ID, Course ID
    • wplms_private_course_button : Filters link on Private course button
    • wplms_private_course_button_label : Filters labels on Private course button
    • wplms_course_details_widget : Filters course details array.
    • wplms_generate_quiz_questions : Filters quiz id returns list of questions generated for the user.
    • wplms_unit_classes : Filters classes added in the units loaded inside the course start page.
    • wplms_incorrect_quiz_answer : Filters incorrect quiz answer marks.
    • wplms_correct_quiz_answer : Filters correct quiz answer marks.
    • wplms_course_drectory_default_order : Filters default course directory order. Used by LMS - settings
    • bp_course_single_item : Filters classes on single course item in course directory
    • wplms_display_course_instructor_avatar : Filters intructor avatar html
    • wplms_instructor_meta : Filters instructor meta value html whereever instructor html is generated.
    • wplms_course_credits_array : Filters the array of multiple payment modes of a course.
    • wplms_course_marks : Filters out course marks.
    • wplms_course_finished : Filters Course finished message.
    • wplms_unfinished_unit_quiz_message : Filters unfinished Quiz or Unit message. Accepts Unit ID/Quiz ID as argument
    • wplms_course_filters_course_cat : Filters out list of categories to be displayed in Course filters widget
    • wplms_course_filter_admin_args : Filters WP User query arguments for Administrator to be included in Instructors.

Execution Sequence

List of important functions to be used in the theme.

  • User registration:
    • wplms_registeration_page : Filters registration page link.
    • bp_core_activated_user : Hook runs after user has activated account. Runs the first time the user activates the account.
    • user_register: Hook runs after user is registered.
  • Course Directory/Taxonomy:
    • bp_before_directory_course_list
    • bp_before_course_loop
    • bp_directory_course_item
    • bp_after_directory_course_list
  • Course subscription:
    • wplms_course_product_id : Filter on Take this course for appropriate course product/membership.
    • wplms_course_product_puchased : Runs when Course product is purchased
    • wplms_before_start_course : Before user stats a course
    • badgeos_wplms_start_course : When a user starts the course
    • badgeos_wplms_unit_complete : Runs when user marks unit as complete.
    • badgeos_wplms_submit_assignment : After assignment is submitted
    • badgeos_wplms_start_quiz : After quiz is started by user
    • badgeos_wplms_submit_quiz : After quiz is submitted by user
    • badgeos_wplms_evaluate_quiz : Runs after quiz is evaluated
    • badgeos_wplms_submit_course : After Course is submitted by user
    • badgeos_wplms_evaluate_course : After course is evaluated

Important Functions

  • bp_course_validate_certificate(array('course_id' =>get_the_ID(),'user_id'=> get_current_user_id()): Validates Course Certificate for a User
  • get_the_course_time(array('course_id' =>get_the_ID(),user_id'=> get_current_user_id()): Returns time in course remaining
  • the_course_button($course_ID): Displays Take this course button with course status (start/continue/finished)
  • bp_course_get_curriculum_units($course_ID): Fetches list of units and quizzes in a course.
  • bp_course_get_course_reviews : Returns course reviews
  • bp_course_count_students_pursuing($course_id) : Returns the template with count of number of students pursuing that course.
  • bp_course_get_total_course_count_for_user($user_id) : Get total course count for an user.
  • bp_course_get_full_course_curriculum($course_id) : Fetches the full course curriculum
  • bp_course_update_quiz_questions($quiz_id,$user_id,$questions): Updates quiz questions
  • bp_course_get_question_details($question_id) : Fetch the question details(i.e. question type, question hint, question explanation)
  • bp_course_remove_quiz_questions($quiz_id,$user_id) : Removes quiz questions from the course
  • bp_course_update_user_quiz_status($user_id,$quiz_id,$status) : Updates the quiz status for that particular user whose id is passed in this function.
  • bp_course_remove_user_quiz_status($user_id,$quiz_id) : Removes the quiz status of a particular user whose id is passed in the function.
  • bp_course_get_user_question_marks($quiz_id,$question_id,$user_id) :Returns the marks of answers
  • bp_course_save_user_answer_marks($quiz_id,$question_id,$user_id,$marks) : Returns the updated marks of the answer
  • bp_course_get_question_marked_answer($quiz_id,$question_id,$user_id) : Returns the marked answers
  • bp_course_get_question_marked_answer_id : Returns the marked answers id
  • bp_course_reset_question_marked_answer($quiz_id,$question_id,$user_id) :
  • bp_course_save_question_quiz_answer($quiz_id,$question_id,$user_id,$answer) : Save answers of quiz questions
  • bp_course_generate_user_result($quiz_id,$user_id,$user_result,$activity_id) : Generate User Results by fetching quiz results.
  • bp_course_get_curriculum($course_id) : Returns curriculum of course
  • bp_course_get_user_expiry_time($user_id,$course_id) : Returns user remaining time
  • bp_course_update_user_expiry_time($user_id,$course_id,$time) : Returns user remaining time after updating user expiry time.
  • bp_course_reset_unit($user_id,$unit_id,$course_id) : Reset course unit
  • bp_course_get_post_type($id) : returns the post type
  • bp_course_get_unit_duration($id) :Returns the unit duration
  • bp_course_get_quiz_duration($id) : Returns the quiz duration
  • bp_course_get_user_unit_completion_time($user_id,$unit_id,$course_id) : Returns unit completion time of an user
  • bp_course_update_user_unit_completion_time($user_id,$unit_id,$course_id,$time) : Update unit completion time of an user
  • bp_course_update_unit_user_access_time($unit_id,$user_id,$time,$course_id=null) : Update access time of unit
  • bp_course_get_curriculum_quizes($course_id) : Return quizzes
  • bp_course_check_unit_complete($unit_id,$user_id,$course_id) : Check if unit is completed or not
  • bp_course_check_quiz_complete($quiz_id,$user_id,$course_id): Check if quiz is completed or not
  • bp_course_get_user_progress($user_id,$course_id) : Returns user progress
  • bp_course_update_user_progress($user_id,$course_id,$progress) : Update user course progress
  • bp_course_get_total_course_count() : Return the total count of course
  • bp_course_get_user_courses($user_id,$status) : Returns user course list
  • bp_course_get_user_course_status($user_id,$course_id) : Returns course status for a user
  • bp_course_update_user_course_status($user_id,$course_id,$status) : Updates course status for a user
  • is_instructor($user_id) : Checks if current user is an instructor
  • bp_get_course_check_course_complete($course_id) : In case of auto evaluation, Returns the message if course is not fully completed
  • bp_course_get_unit_course_id($unit_id): Return course id with which the unit is attached
  • bp_course_is_my_instructor($instructor_id ,$user_id): Return true for the instructor if the course is published by him.
  • bp_course_check_course_drip($course_id,$user_id) : Check course drip feed
  • bp_course_get_total_course_drip_duration($course_id,$user_id) :Returns total course drip duration
  • bp_course_get_drip_access_time($unit_id,$user_id,$course_id) : Return drip access time
  • bp_course_update_drip_Access_time($unit_id,$user_id,$time,$course_id : Return the updated drip access time
  • bp_course_get_drip_status($course_id,$user_id,$unit_id) : Return drip status(unit cannot be accessed, unit is available in)
  • bp_course_get_course_applicants_count($course_id) : Return count of applicants
  • bp_course_get_start_date($course_id,$user_id) : Return course strat date
  • bp_course_get_course_duration($course_id,$user_id) : Return course duration
  • bp_course_get_marks($user_id,$course_id) : Fetch course marks
  • bp_course_quiz_results($quiz_id,$user_id,$course) : After quiz submission, this function display the popup form with quiz results in which obtained marks with question marks is also displayed
  • bp_course_get_quiz_questions($quiz_id,$user_id): Return quiz questions
  • bp_course_get_question_marked_answer($quiz_id,$question,$user_id): return those questions whose answer is amrked
  • bp_course_quiz_retake_form($quiz_id,$user_id,$course) : Display the result of previous retakes of quizzes
  • bp_course_nav_menu() : Display Navigation Menu for Buddypress Course
  • the_course_button($id): Display the course Button according to the case(start course, Continue Course, Private Course)
  • bp_get_course_user_time_left(array('course' =>get_the_ID(),'user'=> get_current_user_id()) : Checks the remaining time of user in course.
  • the_quiz_timer() : Displays the quiz timer while user is taking the quiz
  • in_quiz_timer() : Displays progress bar and time in the timer
  • in_quiz_timeline() : If user marked correct answer it will display "correct" and if answer is wrong it will display "incorrect". It will display a message if your quiz is empty
  • the_quiz_timeline() : When check answer switch is enabled, it will display question and its marks.
  • tofriendlytime($seconds,$force) : Return time labels
  • the_course_timeline($course_id,$uid) : If course curriculum is empty, then it will return a message that course curriculum is not set. When curriculum is set, access next unit if previous unit is completed.
  • the_unit($id): Displays all the content inside unit(unit attachments, unit content, link to ask questions)
  • bp_course_get_unit_attachments($id) : Return unit attachments
  • the_unit_tags($id): Displays the list of unit tags
  • the_unit_instructor($id): Display the unit instructor
  • wplms_user_course_check($user_id,$course_id): Checks is course is taken by user
  • wplms_user_course_active_check($user_id,$course_id): Checks is course is taken by user and is not expired
  • bp_get_course_badge($id) : Return the badge
  • bp_course_get_user_badges($user_id) : Return badge for a particular user
  • bp_course_get_badge($badge_id,$title_id) : Display badge in profile
  • bp_course_get_user_certificates($user_id) : Return user certificate
  • bp_get_course_certificate(array('course_id' =>get_the_ID(),'user_id'=> get_current_user_id()) : Returns Certificate link if applicable.
  • bp_get_total_instructor_count() : Return total instructor count
  • bp_course_quiz_auto_submit($quiz_id,$user_id) : Execute when course quiz is auto submitted and evaluate the quiz automatically.
  • bp_course_save_user_answer_marks($quiz_id,$question,$user_id,$marks) : save user's answer marks
  • bp_course_update_user_quiz_status($user_id,$quiz_id,1) : Update user quiz status (from under evaluation -> to evaluated)
  • bp_course_evaluate_question($marked_answer) : This function will evaluate individual question function and return incorrect one
  • bp_course_validate_certificate(course_id' =>get_the_ID(),'user_id'=> get_current_user_id()) : Validate certificate for user
  • bp_course_add_user_to_course($user_id,$course_id) : Add user to a course.
  • bp_course_get_user_courses($user_id): Returns array of Course Ids
  • bp_course_remove_user_from_course($user_id,$course_id) : Remove user from course
  • bp_wplms_get_theme_color: Returns theme color set in theme customiser
  • bp_wplms_get_theme_single_dark_color() : Return the color of the theme option single dark color in customizer
  • bp_course_get_course_submission_count($course_id) : return the count of course submissions
  • bp_course_record_instructor_commission($instructor_id,$commission,$course_id,$meta) : Record Instructor commission
  • bp_course_get_course_announcements_for_user($user_id) : Return the array of course announcements for user
  • bp_course_get_total_quiz_count_for_user($user_id) : Returns the count of published quizzes
  • bp_course_api_get_user_badges($user_id) :
  • bp_course_api_get_user_certificates($user_id) :
  • bp_course_student_quiz_retake(course_id' =>get_the_ID(),'user_id'=> get_current_user_id()) :
  • bp_course_fetch_user_quiz_retake_count($quiz_id,$user_id) : return retake count, Number of times the user has retaken the quiz
  • bp_course_update_user_quiz_retake_count($quiz_id,$user_id,$value) : Update user quiz retakes count
  • bp_course_reset_quiz_retakes($quiz_id,$user_id) : Reset quiz retakes

API Endpoints

WPLMS API Endpoints : The wplms API uses the namespace : wplms/v1, using this with the endpoints we can get information from a wplms website.

Following are the endpoints (type=GET):


  1. Response Codes:The HTTP response codes indicate if a request to the server has been successfully processed or not. This chapter lists the most common response codes in the WPLMS. The API-specific response codes and messages are described in the respective API reference chapters.

    Success:The following is the most common response codes in the WPLMS system when a request is succesfully processed.
    Response Code Description
    200 Success Call

    Error Handling
    There are two types of error codes:
    • Client (4xx): Authentication failure or invalid domain on the client side
    • Server (5xx): Server errors

    The following tables list the most common error codes in the WPLMS.
    Error Code Description
    400 Bad request. Invalid input parameters
    401 Unauthorized. API Token or Affiliate Tracking ID invalid
    403 Forbidden. Tampered URL
    404 Not found

  2. Registration

    1. Start registration
    2. Add Json data on this url=http://localhost/wordpressnew/wp-json/wplms/v1/user/register : { client_id:"RDRc53PSL8ncHowchpkBi3O", state:"FE7dN0cp", username:"test", email:"test@test.sada", password:"1234" }
      • For client Id : Go to wp-admin > lms > settings > api > connected clients
        screenshot
    3. Return data format: { "status":true, "message":"Registration complete !", "user":{ "id":12, "name":"test", "sub":"", "email":"test@test.sada", "avatar":"http:\/\/localhost\/wordpressnew\/wp-content\/uploads\/2016\/02\/thumbsup-1.png" }, "token":{ "access_token":"7XneUyNdXs7zHmhrROXAPeIfI6a7dlKhGc(#e8VE", "client_id":"RDRc53PSL8ncHowchpkBi3O", "user_id":12, "expires":"2018-03-21 12:07:05", "scope":null } }
    4. Access : access_token : 7XneUyNdXs7zHmhrROXAPeIfI6a7dlKhGc(#e8VE

  3. track:The most important endpoint is the “track” endpoint because it gives all the changes made in the website with their timestamp,
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/track
    refer:
    screenshot

    also track the data via timestamp by adding “/?access=1502523502” where “1502523502” is the particular timestamp, refer:
    screenshot
  4. track/(?P\\d+)?: You can track all the data related to a particular user by adding his/her id after track,
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/track/1
    refer:
    screenshot
    Similarly you can add “?access=1502523502” i.e. the timestamp to get the data of the user from a particular timesatmp.

  5. course: This endpoint gives you information of all the courses present in your wplms website
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course
    refer:
    screenshot
  6. course/(?P\\d+)?: Using this endpoint you can get the data of a particular course using the course id
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course/1250
    refer:
    screenshot
  7. course/featured:You can use this endpoint to get all the featured courses on the wplms website
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course/featured
    refer:
    screenshot
  8. course/popular: You can use this endpoint to get all the popular courses from the wplms website
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course/popular
    refer:
    screenshot
  9. course/filters(?P.+)?: This endpoint uses the json data as the url to fetch results, for example if you want to fetch the recent courses then use the json data in the url
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course/filters?filter=%7B%22search%22:%22%22,%22filters%22:%5B%5D,%22sort%22:%22popular%22,%22paged%22:1%7D
    refer:
    screenshot
  10. instructors:This endpoint is used for fetching all the instructors in the website
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/instructors/
    refer:
    screenshot
  11. instructors/(?P\d+)?: You can also fetch the insformation of a single instructor from the website through the instructor id
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/instructors/5
    refer:
    screenshot
  12. course/taxonomy(?P.+)?:You can also fetch the information of taxonomy from the website like course-cat, level, location, etc.
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course/taxonomy/?taxonomy=course-cat
    refer:
    screenshot
  13. course/category/(?P\d+)?:You can also fetch the information of a particular course category through its id
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/course/category/40
    refer:
    screenshot



Now there are user endpoints, these end points require the “Authorization” to be passed in the headers to fetch the information. You need to send the access token of the client as Authorization in the header which you can get from the connected clients in the API.

Following are the endpoints for users (Type=GET):
  1. user:This endpoint gives you the id of the user who is connected to the app i.e. the user who’s access token is sent in the headers
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/user/
    refer:
    screenshot
  2. user/profile:This endpoint fetches all the information or the data that is shown to the user in his/her profile page, like the user can see dashboard, courses, etc tabs in his/her profile
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/user/profile
    refer:
    screenshot
  3. user/profile/(?P\w+)?(&P\d+)?(&P\d+): This endpoint lets you fetch the information according to particular tabs, you can also use “per_page=” to get limited information on a page, you can also add “paged=” to directly jump onto a particular page. For example if you want the information of tab profile then use the endpoint as namspace/user/profile/?tab=profile
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/user/profile/?tab=profile
    refer:
    screenshot
  4. user/coursestatus/(?P\d+)?: This endpoint can be used to get the full information of the course status page for the user who’s access token is sent in the header, in the endpoint you provide the course id to get the status for that particular course. It lets you know if the course has been expired for the user or if the user is continuing the course and all other information related to that particular course status for the particular user
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/user/coursestatus/2851
    refer:
    screenshot
  5. user/coursestatus/(?P\d+)/item/(?P\d+)?:This endpoint is similar to the previous one but it uses the course id and then the unit id who’s information you need for the particular user
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/user/coursestatus/2851/item/242
    refer:
    screenshot
  6. user/getreview/(?P\d+):This endpoint is used to get the review of the user from a particular course by using the course id
    Url : http://localhost/wordpressnew/wp-json/wplms/v1/user/getreview/2851
    refer:
    screenshot

Like WPLMS ?

Rate us at Themeforest

Every rating counts and helps us to improve WPLMS. How to rate WPLMS ?

Not Happy ?

Send us an email at vibethemes@gmail.com and share feedback.