Action
tin-canny-learndash-reporting
uo_tincanny_reporting_questions_table_tbody_beforeend
Fires after the Tincanny reporting questions table body is rendered, allowing for custom content insertion.
add_action( 'uo_tincanny_reporting_questions_table_tbody_beforeend', $callback, 10, 1 );
Description
Fires after the `
` of the Uncanny Toolkit's Question Analysis Report table is fully rendered. Developers can use this hook to add custom content or modify existing elements within the report's question data section. It's intended for advanced customization of the report table.Usage
add_action( 'uo_tincanny_reporting_questions_table_tbody_beforeend', 'your_function_name', 10, 1 );
Examples
add_action( 'uo_tincanny_reporting_questions_table_tbody_beforeend', 'my_uncanny_tincanny_report_extension', 10, 0 );
/**
* Adds a custom column to the Uncanny Tincanny Questions Report table.
*
* This function hooks into 'uo_tincanny_reporting_questions_table_tbody_beforeend'
* to inject a new table cell after the existing rows have been rendered, but before
* the table footer begins. In this example, it adds a "Notes" column that displays
* a static message. In a real-world scenario, you might fetch dynamic data related
* to the questions or the report.
*
* Note: This hook does not provide any parameters, so the accepted_args is 0.
*/
function my_uncanny_tincanny_report_extension() {
// In a real-world scenario, you would likely have access to $question or
// other relevant data if the hook provided parameters. Since it doesn't,
// we're adding static content or performing an action that doesn't rely
// on loop variables directly.
// For demonstration, let's add a row with a custom message.
// This would typically be rendered within the <tbody>, but since this hook
// fires at the end of the tbody, we're effectively adding it after the last row.
// A more practical use might involve fetching data based on the overall report context.
?>
<tr>
<td colspan="5" class="report-data custom-notes">
<strong>Internal Note:</strong> This section is for custom reporting enhancements.
You could fetch and display additional data here, like average score per question type
or flags for questions needing review.
</td>
</tr>
<?php
}
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:976
<!-- Average time -->
<td class="report-data avg-time"><?php echo self::get_avg_time( $question->question_id ); ?></td>
<!-- Question ID -->
<!-- <td>-->
</tr>
<?php } ?>
<?php do_action( 'uo_tincanny_reporting_questions_table_tbody_beforeend' ); ?>
</tbody>
<tfoot>
<tr>
<?php foreach ( self::$columns as $col ) { ?>
<th><?php echo $col; ?></th>
<?php } ?>