kgps
(Mohammad)
June 23, 2021, 12:54pm
1
Hi. So I’m wondering if we can utilize tokens for WP Activity Log. This plugin provides a lot data and as far as I can see, there aren’t any tokens to add to reports.
Unless there’s another way to add data to reports. Things like how many users have logged in, how many posts were created, etc. would be nice to add.
Please advise of a workaround!
Thanks!
bogdan
(Bogdan Rapaić)
June 23, 2021, 3:47pm
2
Hi Mohammad,
Here are filters for creating custom tokens:
For Client Reports:
add_filter( 'mainwp_client_reports_custom_tokens', 'mycustom_mainwp_client_reports_custom_tokens', 10, 3 );
function mycustom_mainwp_client_reports_custom_tokens( $tokensValues, $report, $website ) {
if ( is_array( $tokensValues ) && isset( $tokensValues['[report.custom.token]'] ) ) {
$tokensValues['[report.custom.token]'] = "your custom value";
}
return $tokensValues;
}
For Pro Reports
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;
}
kgps
(Mohammad)
June 24, 2021, 12:23am
3
@bogdan , Thanks much for the prompt reply and for the solution.
I will definitely be looking into this.
bogdan
(Bogdan Rapaić)
June 24, 2021, 12:46pm
4
Hi Mohammad, you are very welcome.
system
(system)
Closed
June 25, 2021, 12:47pm
5
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.