Activity Log Tokens

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!

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;
}

@bogdan , Thanks much for the prompt reply and for the solution.

I will definitely be looking into this.

Hi Mohammad, you are very welcome.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.