Monthly Archives: June 2013

WatuPRO 3.6 and The Play Plugin

The Upgrade

There has been a significant upgrade of WatuPRO with several important features and bug fixes:

– Resolved conflicts with all known membership plugins
– “Show results” button can be always visible on ‘one question per page’ quizzes, but warns about premature submitting. Useful for long quizzes.
– Schedule exam (makes it available only in selected date ranges)
– All user roles can now use the exams. The limitation to Student role caused far more issues than benefits so we decided to drop it altogether. You can still manage which roles have access to manage the tests.
– You can now use WordPress User Roles instead of User Groups to avoid redundancy, and for better integration with membership plugins.
– Navigation improvements
– Filter test results by user role
– Started developers API (see the previous post for more information)

As usual upgrade is free for users who purchased WatuPRO less than one year ago and will be delivered by a newsletter in the next few days.

The Play Plugin

Another thing to note is the new plugin called Watu PRO Play. It adds gamification element to Watu PRO and lets you assign levels and badges, allow users to redeem rewards, generates many leaderboards, and more. Just check the site for more info or email us with your questions.

WatuPRO Hooks Reference & Developers API

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

Main Concept

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

Available actions

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.

do_action(‘watupro_show_exam_js’, $exam) – lets you plug your custom javascript in the quiz itself. Passes the $exam object.

Available Filters

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.

The following filters allow you to modify the content of the emails sent to admin or quiz taker when a quiz is completed:

$output = apply_filters(‘watupro-email-results-taker’, $output, $taking_id);

$output = apply_filters(‘watupro-email-results-admin’, $output, $taking_id);

The following filter allows you to modify the content of user uploaded files:

$contents = apply_filters(‘watupro-user-file-uploaded’, $contents, $question_id, $detail_id, $taking_id);

$achieved = apply_filters(‘watupro-achieved-points’, $achieved, $taking_id); – allows third party plugins to modify number of points

The following filter is applied on calculating quiz grade:

watupro_calculate_grade -it’s more complicated so it’s documented separately here.

Expect a lot more actions to be added in the next versions of Watu PRO.