I’d be happy to explain one part of the necessary steps. Unfortunately, the other part is entirely dependent on the information you wish to include in the report, and in this case, it’s somewhat complicated.
This part would need to be inserted into the functions.php file of your child theme, or even better by using our Custom Dashboard extension.
add_filter( 'mainwp_pro_reports_custom_tokens', 'mycustom_mainwp_pro_reports_custom_tokens', 10, 3 );
function mycustom_mainwp_pro_reports_custom_tokens( $tokensValues, $report, $website ) {
if ( is_array( $tokensValues ) && isset( $tokensValues['[report.custom.token]'] ) ) {
$tokensValues['[report.custom.token]'] = "your custom value";
}
return $tokensValues;
}
In that example code, we are mostly interested in this line: $tokensValues[‘[report.custom.token]’] = “your custom value”;
report.custom.token can be anything you want and will be used to insert the data in the report. For example [my.ithemes.token]
.
But the value part is the complicated one.
You would essentially need to write custom code which would process iThemes data and present it in the desired way so that you could insert it into the Report.
So let’s say custom_code()
processes iThemes information, and the processed data is stored in the database in your new [ithemes.log.data]
array.
You would then retrieve that information from the database before the filter is executed, by stating something like $ithemeslogdata = $website['ithemes.log.data'];
And the line in the filter would then look something like $tokensValues['[my.ithemes.token]'] = "$ithemeslogdata";
.
Hopefully, this helps.