Actions/Filters for Developers

Tin Canny includes WordPress filters for developers building custom functionality on top of the plugin. This article lists the available hooks, grouped by what they affect.

Permissions & capabilities

Control who can access reporting features and data.

FilterDefaultDescription
uo_tincanny_reporting_capabilitytincanny_reportingCapability required to view the Tin Canny reporting admin menu/pages. Defaults to the plugin’s own custom tincanny_reporting capability — not manage_options.
tincanny_view_all_reports_permission(boolean)Whether the current user may view all reports rather than only their own groups. Receives a boolean (default is the result of an “is current user an admin” check), so return true/false — not a capability string.
tincanny_can_get_datamanage_optionsMinimum capability for a logged-in user to retrieve report data via REST.
uo_tincan_ld_admin_capability_checkmanage_optionsAdded in v5.1.1. The capability checked when granting access to reporting features. Use this to open reporting to custom roles.
add_filter( 'uo_tincan_ld_admin_capability_check', function ( $capability ) {
    return 'edit_courses'; // allow any role with this cap to view reporting
} );

Data capture & processing

Control which statements are recorded and how.

FilterSignatureDescription
tincanny_module_allow_db_capture($allow = true, $db_data)Controls whether a module’s statements are written to the database. Enhanced in v5.1.3 to also support skipping specific xAPI events. (Verified: TinCanRequest.php.)
tincanny_process_content($process = true, $array)Controls whether captured content is processed. Enhanced in v5.1.3 to support skipping xAPI events. (Verified: Server.php.)
uo_tincanny_actor_name($user_name, $User)Added in v5.1.3.3. Overrides the learner name (actor) passed to a module, e.g. to use a display name or anonymized identifier. The second argument is the WP_User object. (Verified in v5.1.3.3 source: Shortcode.php, TinCan_Content_List_Table.php.)
add_filter( 'uo_tincanny_actor_name', function ( $user_name, $user ) {
    return 'Learner #' . $user->ID; // anonymize the actor name sent to modules
}, 10, 2 );

Scoring & results

Adjust how scores and results are interpreted in reports.

FilterSignatureDescription
uo_tincanny_data_consider_scaled_score($consider = false)Added in v5.0. Return true to make reporting use the module’s scaled score rather than the raw score. (Verified: Database/Admin.php.)
tincanny_result_override($override = null, $TC_Result)Added in v5.1.0.3. Return a non-null value to override the stored result of a Tin Can statement before it’s reported. (Verified: TinCanRequest.php.)

Reports & front-end output

Customize report links and display.

FilterSignatureDescription
uo_tincanny_quiz_report_user_report_url($user_report_url)Added in v5.0. Overrides the userReportUrl used by the [uo_group_quiz_report] shortcode so learner names link to the correct individual user report page. (Verified: quiz-module-reports.php.)

Module display (lightbox)

Tin Canny modules can open in a GLightbox lightbox. Its JavaScript configuration is filterable.

  • uo_tincanny_glightbox_configAdded in v5.1.0.1. Filters the lightbox config array. The array includes a closeOnOutsideClick key (string ‘0‘ = disabled by default, ‘1‘ = enabled) that controls whether clicking outside the lightbox closes it. Set it to ‘1‘, or to ‘0‘ to prevent learners from accidentally closing a module mid-activity. (Verified: uncanny-articulate-and-captivate/classes/Shortcode.php.)

add_filter( ‘uo_tincanny_glightbox_config’, function ( $config ) {

add_filter( 'uo_tincanny_glightbox_config', function ( $config ) {
    $config['closeOnOutsideClick'] = '0'; // don't close on outside click
    return $config;
} );

The vc_snc shortcode that embeds a module also accepts a closeOnOutsideClick attribute directly.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top