Action tin-canny-learndash-reporting

tincanny_reporting_xtin_quiz_before_end

Fires before the quiz ends, allowing for custom actions to be performed.

add_action( 'tincanny_reporting_xtin_quiz_before_end', $callback, 10, 1 );

Description

Fires before the Tin Can reporting quiz content is rendered. Developers can use this hook to add custom filters, modify the quiz's behavior, or inject additional information before the quiz conclusion.


Usage

add_action( 'tincanny_reporting_xtin_quiz_before_end', 'your_function_name', 10, 1 );

Examples

add_action( 'tincanny_reporting_xtin_quiz_before_end', 'my_custom_xtin_quiz_reporting_logic', 10, 0 );

/**
 * Example function to add custom logic before the xTincan quiz reporting ends.
 * This could be used to log additional data, modify the output slightly,
 * or perform other custom actions.
 *
 * @since 1.0.0
 */
function my_custom_xtin_quiz_reporting_logic() {
	// In a real-world scenario, you might access global variables or
	// other context-dependent data here to perform your action.
	// For demonstration purposes, we'll just simulate some logging.

	if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
		error_log( 'Custom action triggered: tincanny_reporting_xtin_quiz_before_end. Performing additional reporting tasks.' );

		// Example: Maybe you want to fetch and display a specific piece of data
		// that isn't normally shown in the default reporting table.
		// Let's assume there's a function to get quiz completion rates.
		// $completion_rates = tin_can_reporting_get_quiz_completion_rates();
		// if ( ! empty( $completion_rates ) ) {
		//     echo '<p>Current Quiz Completion Rates: ' . esc_html( $completion_rates ) . '</p>';
		// }
	}
}

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/shortcode-tincanny/shortcode-tincanny.php:844

public static function admin_reporting_content() {
		?>

		<div class="uo-admin-reporting-tab-single" id="tin-can"
			 style="display: <?php echo self::$is_tincan_report ? 'block' : 'none'; ?>">

			<?php
			// Add Tin Can tab content.
			if ( self::$is_tincan_report ) {
				do_action( 'tincanny_reporting_tin_can_after_begin' );

				include dirname( UO_REPORTING_FILE ) . '/src/reporting/tin-can/templates/tc-tincan-filter.php';

				do_action( 'tincanny_reporting_tin_can_before_end' );
			}
			?>

		</div>

		<div class="uo-admin-reporting-tab-single" id="xapi-tincan"
			 style="display: <?php echo self::$is_xapi_report ? 'block' : 'none'; ?>">

			<?php
			// Add xAPI tab content.
			if ( self::$is_xapi_report ) {
				do_action( 'tincanny_reporting_xtin_quiz_after_begin' );

				self::show_tincan_list_table( 'xapi-tincan' );

				do_action( 'tincanny_reporting_xtin_quiz_before_end' );
			}
			?>

		</div>

		<?php
	}


Scroll to Top