tincanny_reporting_wrapper_before_begin
Fires before the main content wrapper for Tincanny reporting begins, allowing for pre-reporting content modifications.
add_action( 'tincanny_reporting_wrapper_before_begin', $callback, 10, 1 );
Description
Fires just before the main reporting wrapper content begins. Developers can use this hook to add custom elements, modify existing structures, or inject specific scripts/styles immediately before the core reporting output is rendered. This hook is intended for internal use and is crucial for controlling the initial rendering of reporting interfaces.
Usage
add_action( 'tincanny_reporting_wrapper_before_begin', 'your_function_name', 10, 1 );
Examples
<?php
/**
* Example function to add a custom section before the main reporting content.
* This could be used to display a summary or a quick filter for the reports.
*
* @param array $report_data Optional. Any data passed from the hook's source.
*/
function my_custom_reporting_preamble( $report_data = [] ) {
// Check if we have any specific report data to display a message about.
if ( ! empty( $report_data['message'] ) ) {
echo '<div class="my-custom-notice notice notice-info"><p>' . esc_html( $report_data['message'] ) . '</p></div>';
}
// A simple visual separator or introductory text.
echo '<h3 class="my-reporting-section-title">Custom Reporting Overview</h3>';
echo '<p>Here you can find an overview of your Tin Can reporting data.</p>';
}
// Add the action to the 'tincanny_reporting_wrapper_before_begin' hook.
// We'll use a priority of 10, and since the hook doesn't pass any specific arguments,
// we'll set the accepted arguments count to 0.
add_action( 'tincanny_reporting_wrapper_before_begin', 'my_custom_reporting_preamble', 10, 0 );
// Example of how you might trigger this hook with specific data from another plugin or theme.
// This would typically be in a different file, perhaps within a plugin's main file or a theme's functions.php.
/*
function trigger_custom_reporting_preamble() {
// Assume some data is generated or retrieved for the reporting section.
$reporting_context = [
'message' => 'Note: Data is for the last 30 days.',
'user_id' => get_current_user_id(),
];
// Use do_action to trigger the hook and pass the custom data.
do_action( 'tincanny_reporting_wrapper_before_begin', $reporting_context );
}
// You would call trigger_custom_reporting_preamble() at the appropriate place
// in your WordPress execution flow to make the above add_action() callback fire.
*/
?>
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:10
src/reporting/tin-can/tin-can-report.php:10
src/shortcode-tincanny/frontend.php:17
src/reporting/learndash/templates/course-user-wrapper.php:12
<div id="ld_course_info" class="uo-tclr-admin uo-admin-reporting">
<?php
do_action( 'tincanny_reporting_after_opening_wrapper' );
uncanny_learndash_reportingTinCannyShortcode::add_header_and_tabs();
do_action( 'tincanny_reporting_wrapper_before_begin' );
?>
<div class="uo-tclr-admin__content">
<div class="uo-admin-reporting-tab-single" id="tinCanReportTab" style="display: block">
<div id="coursesOverviewContainer">