tincanny_reporting_wrapper_after_end
Fires after the Tincanny reporting wrapper's HTML content has ended, allowing for custom additions or cleanup.
add_action( 'tincanny_reporting_wrapper_after_end', $callback, 10, 1 );
Description
Fires after the main Tincanny reporting wrapper element has closed. Developers can use this hook to inject custom content or scripts that need to be placed directly after the reporting area, but before any subsequent page elements. It's ideal for tracking scripts or elements that relate to the completed reporting view.
Usage
add_action( 'tincanny_reporting_wrapper_after_end', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Add a custom message after the Tin Can reporting wrapper ends.
* This could be used to display a summary, a call to action, or additional context.
*/
add_action( 'tincanny_reporting_wrapper_after_end', function() {
// Check if we are currently viewing a specific report type or context where this message is relevant.
// For this example, let's assume we only want to show it on course completion reports.
// In a real scenario, you might check $_GET or $_POST variables, or a custom user meta.
// Example: Let's say there's a 'report_type' query parameter.
$report_type = isset( $_GET['report_type'] ) ? sanitize_text_field( $_GET['report_type'] ) : '';
if ( 'course_completion' === $report_type ) {
// Fetch some data that might be relevant to the end of a report.
// This is a hypothetical example; in reality, you'd likely get data from
// WordPress queries, custom database tables, or the Tin Can API itself.
$completion_message = 'Congratulations on completing the course!';
$next_step_message = 'Explore related courses or resources below.';
// Output the custom messages.
echo '<div class="tincanny-report-summary">';
echo '<p>' . esc_html( $completion_message ) . '</p>';
echo '<p>' . esc_html( $next_step_message ) . '</p>';
// You could also add buttons, links, or other HTML elements here.
echo '</div>';
}
// Another example: Displaying a timestamp of when the report was last viewed.
// This assumes you have a way to store and retrieve this information,
// perhaps using transient API or user meta.
$last_viewed_timestamp = get_transient( 'tincanny_report_last_viewed_' . get_current_user_id() );
if ( $last_viewed_timestamp ) {
echo '<p><small>Report last viewed: ' . esc_html( date_i18n( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $last_viewed_timestamp ) ) . '</small></p>';
}
}, 10, 0 ); // Priority 10, 0 accepted arguments.
?>
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:63
src/reporting/tin-can/tin-can-report.php:63
src/shortcode-tincanny/frontend.php:84
src/reporting/learndash/templates/course-user-wrapper.php:60
<?php do_action( 'tincanny_reporting_wrapper_before_end' ); ?>
</div>
</div>
</div>
</div>
<?php do_action( 'tincanny_reporting_wrapper_after_end' ); ?>