As WatuPRO is growing we see the need of many customers to enhance and customize it. We do provide some customization services but can’t handle all of the requests. Besides, we wanted to allow third party developers and companies to extend WatuPRO and add more functionality to it. So here is the first version of the developers API. Please consider this page work in progress, as is the API itself. We are starting with just a few basic function calls. More will be added and documented with the time. For simplicity the API itself will use the same version number as the plugin.
WatuPRO API Version 3.6
WatuPRO API uses WordPress do_action calls to create custom actions. This means that in order to add custom functionality you need to use add_action() to call your custom functions. Any custom parameters passed to do_action will be shown below.
Barebone Custom Plugin
We have created a “barebone” custom plugin that will help you with the initial setup for your custom work. Download the plugin here: watupro-custom
do_action(‘watupro_completed_exam’, $taking_id) – called when test is completed. Passes the current completed exam record ID.
do_action(‘watupro_completed_exam_edited’, $taking_id) – called when admin/teacher edits user’s details. This option is enabled by the “Manual grading” feature in the Intelligence module. Passes the ID of the taken exam record.
do_action(‘watupro_my_certificates’) – this call is at the bottom of the “My certificates” page. The action passes no parameters but you can get the current user ID as a global. This action is already used by the Play Plugin.
do_action(‘watupro_select_show_exam’, $exam) – called when displaying the exam on the screen, and prior to any permission checks. Passes the exam object and allows you to do something with it.
do_action(‘watupro_admin_menu’) – lets you hook a custom page under watupro admin menu. Use ‘watupro_exams’ as parent.
do_action(‘watupro_user_menu’) – lets you hook a custom page under watupro user dashboard menu. Use ‘my_watupro_exams’ as parent.
We have started adding some filters too:
apply_filters( ‘watupro_filter_view_show_exam’, $show_exam_view, $exam); – called right before showing the quiz. You can use it to load your custom show_exam view. We recommend to still include our view (views/show_exam.php) and use it only to do something before or after it.
apply_filters( ‘watu_filter_current_question_text’, $current_text, $qct, $question_content, $correct ) – called after a question has been processed so you can modify the way it’s displayed on the final screen and live result.
Expect a lot more actions to be added in the next versions of Watu PRO.