[WatuPRO Intelligence] Runtime Logic in WatuPRO + Intelligence Module

The following runtime logics are supported from WatuPRO + Intelligence module version 4.9.7. Both logics require the quiz to be paginated “Each question on its own page” for the obvious reason that we need to be able to figure out how many questions they have gone through so far.

Premature Quiz Ending

This allows you to auto-submit the quiz before the last question if the user fails to meet required % correct answers during the quiz. You can choose the required % and you can choose after which question to start doing this check (because it usually doesn’t make sense to do it before the user answered at least several questions).

If the user keeps their correct answers above the threshold they can continue with the quiz. Otherwise the quiz is automatically submitted with the questions answered up to that point. Normally this means the test taker has failed the test.

Prevent Moving Forward

Some quizzes are built to educate the user rather than to assess them. In such quizzes you may want to encourage the user to answer questions correctly before they can continue further. This option lets you disallow going further until the previously answered questions are at least X% correctly answered.

In such quizzes you need to enable either previous button or numbered paginator – otherwise the user can be locked and unable to continue or submit the quiz.

Here is how these configurations look. You can find them in Edit Quiz -> Intelligence Module tab:

runtime-logicNote that entering non-zero numeric value in the boxes will set “automatically store user progress as they go from page to page” to true when you save the quiz.

Using PayPal Payment Data Transfer (PDT) Instead of IPN in Hostel and HostelPRO Plugins

From version 1.7.1 the plugin HostelPRO supports payment verifications by Paypal Data Transfer (PDT). The reason is that some customers may experience delays in receiving the paypal IPN response. The PDT payment mode can also be useful if you are running the plugin on intranet or want to test it on localhost.

Here is what you need to do to enable PDT payment handling:

  • Enable PDT in your Paypal account. More information here (see under “How to get started”).
  • Enter anything as Return URL in your Paypal account. It doesn’t matter, we generate another one on the fly
  • In HostelPRO Settings page select “Use Paypal PDT instead of IPN”. A box will appear to enter your token, obtained in step 1. This setting appears when you select Paypal as payment method.

That’s it. Your site will now use PDT instead of IPN. You can test it in Sandbox mode.

HostelPRO Developers API

From version 1.7 the WordPress plugin HostelPRO supports basic API to help deveopers extend its functionality. The API currently provides mostly hooks fired when some data in the system is added or changed – i.e. booking is made, room is added, field is deleted etc.

If you need a specific hook or filter to be added please contact  us at hi@wp-hostel.com and it may be added to the next version.

Available API Hooks in Models:

These hooks are do_action calls fired when item is added, modified or deleted. They should be caught by add_action calls.

Main plugin file:

do_action(‘hostelpro_admin_menu’);   – called after all menu links. Lets you plug your custom menu links under the HostelPRO menu.

do_action(‘hostelpro_init’); – called when the plugin initialization is completed.

Rooms:

do_action(‘hostelpro_room_added’, $id); – when room is added. Passes the room ID.

do_action(‘hostelpro_room_edited’, $id, $vars); – when room is edited. Passes the room ID and the full array of new data (typically coming from $_POST).

do_action(‘hostelpro_room_deleted’, $id); – when room is deleted. Passes the field ID.

Bookings:

do_action(‘hostelpro_booking_paid’, $id); – when booking is paid (either from admin or verified Paypal / Stripe payment)

do_action(‘hostelpro_booking_added’, $id); – when booking is added. Passes the booking ID.

do_action(‘hostelpro_booking_edited’, $id, $vars); – when field is edited. Passes the booking ID and the full array of new data (typically coming from $_POST).

do_action(‘hostelpro_booking_deleted’, $id); – when bookin g is deleted. Passes the booking ID.

do_action(‘hostelpro_booking_cancelled’, $id); – when booking is cancelled.

do_action(‘hostelpro_booking_data_saved’, $id, $vars);– when the custom data about booking is saved (the data from the custom fields).

Addon Services:

do_action(‘hostelpro_addon_added’, $id); – when addon service is added. Passes the addon ID.

do_action(‘hostelpro_addon_edited’, $id, $vars); – when addon service is edited. Passes the addon ID and the full array of new data (typically coming from $_POST).

Discounts / Surcharges:

do_action(‘hostelpro_discount_added’, $id); – when discount / surcharge is added. Passes the discount / surcharge ID.

do_action(‘hostelpro_discount_edited’, $id, $vars); – when discount / surcharge is edited. Passes the discount / surcharge ID and the full array of new data (typically coming from $_POST).

do_action(‘hostelpro_discount_deleted’, $id); – when discount / surcharge is deleted. Passes the discount / surcharge ID.

Booking Form Fields:

do_action(‘hostelpro_field_added’, $id); – when field is added. Passes the field ID.

do_action(‘hostelpro_field_edited’, $id, $vars); – when field is edited. Passes the field ID and the full array of new data (typically coming from $_POST).

do_action(‘hostelpro_field_deleted’, $id); – when field is deleted. Passes the field ID.

Available API Hooks in the Views

In addition  to the above actions each of the admin pages for editing an item also let you add your own form elements on it so you can process custom data with the form:

do_action (‘hostelpro_booking_form’, @$booking) is on the Add / Edit Booking form. Passes the $booking object in case of editing.

do_action (‘hostelpro_room _form’, @$room) is on the Add / Edit Room  form. Passes the $room object in case of editing.

do_action (‘hostelpro_field_form’, @$field) is on the Add / Edit Field form. Passes the $field object in case of editing.

do_action (‘hostelpro_discount_form’, @$discount) is on the Add / Edit Discount / Surcharge form. Passes the $discount object in case of editing.

do_action (‘hostelpro_addon_form’, @$addon) is on the Add / Edit Addon  form. Passes the $addon object in case of editing.