uo_tincanny_reporting_ispring_11_include_tin_can_support
Filters whether Tin Can API support is included for iSpring reporting, controlling its inclusion.
add_filter( 'uo_tincanny_reporting_ispring_11_include_tin_can_support', $callback, 10, 1 );
Description
Filters whether iSpring Suite 11 content should include Tin Can API support. By default, support is included. Return `false` to prevent iSpring 11 modules from loading their specific Tin Can reporting script.
Usage
add_filter( 'uo_tincanny_reporting_ispring_11_include_tin_can_support', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
add_filter( 'uo_tincanny_reporting_ispring_11_include_tin_can_support', 'my_custom_tincanny_ispring_11_support', 10, 1 );
/**
* Conditionally enable or disable Tin Can API support for iSpring Suite version 11.
*
* This filter allows developers to override the default behavior of enabling Tin Can API
* support for iSpring Suite version 11. For example, you might want to disable it
* for specific modules or under certain conditions.
*
* @param bool $include_support Whether to include Tin Can API support. Default is true.
* @return bool The modified value for including Tin Can API support.
*/
function my_custom_tincanny_ispring_11_support( $include_support ) {
// Example: Disable Tin Can API support for iSpring Suite 11 if the current
// WordPress user has a specific role.
if ( is_user_logged_in() && current_user_can( 'editor' ) ) {
return false; // Do not include Tin Can API support for editors
}
// Example: Always include support unless explicitly disabled by another filter.
// In this case, we just return the passed value.
return $include_support;
}
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/uncanny-articulate-and-captivate/classes/FileSystem/Module/iSpring.php:72
return true;
}
// Check for version 11.
$is_version_11 = strstr( $ispring_html, 'version 11.' );
if ( $is_version_11 ) {
$file_js = 'assets/scripts/module_supports/iSpring11-lms.js';
if ( false === apply_filters( 'uo_tincanny_reporting_ispring_11_include_tin_can_support', true ) ) {
// Add filter to determine if we should bail out.
// See ticket #47898 - bailout added now causing issues with #60277 & #60460
return; // bail out.
}
}
$explode_wp_content_dir = explode( '/', WP_CONTENT_DIR );