Action tin-canny-learndash-reporting

uo_tincanny_reporting_questions_table_beforebegin

Fires before the Tincanny reporting questions table begins, allowing modifications before output.

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

Description

Fires before the Uncanny Toolkit's Question Analysis Report table begins rendering. Developers can use this hook to inject custom content or modify table elements before the main table structure is output, offering fine-grained control over report presentation.


Usage

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

Examples

<?php
/**
 * Adds a custom introductory message before the question analysis report table.
 *
 * This function demonstrates how to hook into the 'uo_tincanny_reporting_questions_table_beforebegin'
 * action hook to insert content just before the main HTML table of the Uncanny Toolkit's
 * question analysis report begins.
 *
 * @since 1.0.0
 */
add_action( 'uo_tincanny_reporting_questions_table_beforebegin', 'my_custom_question_report_intro', 10 );

/**
 * Callback function for the 'uo_tincanny_reporting_questions_table_beforebegin' hook.
 *
 * @param array $args Optional arguments passed to the hook (if any).
 */
function my_custom_question_report_intro( $args = [] ) {
	// Check if the current page context is relevant (e.g., a specific Uncanny Course/Lesson report page).
	// In a real scenario, you might check $_GET parameters or current screen information.
	// For this example, we'll assume it's always relevant if this hook fires.

	// You can optionally pass data through the hook if the source context supports it.
	// For this specific hook, no parameters are documented as being passed by default.
	// However, if you were filtering, you would expect to return a modified value.

	$report_title = 'Student Question Performance Analysis';
	$additional_info = 'This report provides insights into how students performed on individual questions across your lessons. Use this data to identify areas where content might be unclear or questions may need refinement.';

	?>
	<div class="uotc-report-intro">
		<h3><?php echo esc_html( $report_title ); ?></h3>
		<p><?php echo esc_html( $additional_info ); ?></p>
		<?php
		// Example: If you wanted to dynamically display something based on available data
		// (assuming $questions and $question_results_sorted were accessible or passed via $args)
		/*
		if ( ! empty( $questions ) ) {
			$total_questions = count( $questions );
			?>
			<p>Currently analyzing <strong><?php echo esc_html( $total_questions ); ?></strong> questions.</p>
			<?php
		}
		*/
		?>
	</div>
	<hr>
	<?php
}

// Note: This is an action hook, so no return statement is needed in the callback.
// The purpose is to inject HTML or perform side effects.

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-question-analysis-report/question-analysis-report.php:896

return ob_get_clean();
					}
				}
				$question_results_sorted = self::get_x_of_y_css_classes();
				$questions               = self::$questions;
				?>

				<?php do_action( 'uo_tincanny_reporting_questions_table_beforebegin' ); ?>

				<table id="uotc-question-report" class="display responsive" cellspacing="0" width="100%">
					<thead>
					<tr>
						<?php do_action( 'uo_tincanny_reporting_questions_table_thead_afterbegin' ); ?>

						<?php foreach ( self::$columns as $id => $col ) { ?>


Scroll to Top