tincanny_reporting_after_content
Fires after the tin can reporting content is displayed.
add_action( 'tincanny_reporting_after_content', $callback, 10, 1 );
Description
Fires after the main reporting content has been displayed. Developers can use this hook to add custom elements, perform post-rendering actions, or modify the reporting section's layout. It executes after the core reporting data and table have been rendered.
Usage
add_action( 'tincanny_reporting_after_content', 'your_function_name', 10, 1 );
Examples
// Example: Add a custom summary section after the main reporting content is displayed.
add_action( 'tincanny_reporting_after_content', 'my_custom_tincanny_reporting_summary', 10 );
/**
* Adds a custom summary section to the Tincanny reporting page.
*
* This function demonstrates how to hook into 'tincanny_reporting_after_content'
* to display additional information or controls after the default reporting
* content. In this example, it adds a simple summary of the total number of
* learners and courses reported on.
*
* @param array $data An array containing the reporting data. Expected keys include 'learners' and 'courses'.
*/
function my_custom_tincanny_reporting_summary( $data ) {
// Ensure we have data to process
if ( ! empty( $data ) && is_array( $data ) ) {
$learner_count = isset( $data['learners'] ) ? count( $data['learners'] ) : 0;
$course_count = isset( $data['courses'] ) ? count( $data['courses'] ) : 0;
// Output a custom summary section
?>
<div class="tincanny-custom-summary">
<h3>Custom Reporting Summary</h3>
<p>Total Learners Reported: <strong><?php echo esc_html( $learner_count ); ?></strong></p>
<p>Total Courses Reported: <strong><?php echo esc_html( $course_count ); ?></strong></p>
<?php
// Example: Add a button to export data (hypothetical)
if ( $learner_count > 0 || $course_count > 0 ) {
?>
<button onclick="alert('Export functionality not yet implemented!');">Export Report</button>
<?php
}
?>
</div>
<?php
} else {
// Optionally display a message if no data is available
?>
<div class="tincanny-custom-summary">
<p>No reporting data available for custom summary.</p>
</div>
<?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/reporting/xapi-quiz/xapi-quiz-report.php:53
src/reporting/tin-can/tin-can-report.php:53
src/shortcode-tincanny/frontend.php:76
src/reporting/learndash/templates/course-user-wrapper.php:52
<?php
} else {
do_action( 'tincanny_reporting_content' );
include __DIR__ . '/templates/table.php';
}
do_action( 'tincanny_reporting_after_content' );
?>
</section>
<?php do_action( 'tincanny_reporting_wrapper_before_end' ); ?>
</div>
</div>
</div>