MainWP Community

Reports WordFence Summary

Is it possible with Pro Reports to summarize how many attacks were blocked? As far as I can tell we only have the option to summarize total scans.

Hey @rhoekman, for something like this you would need to code custom token.

If you are interested in this, I can send you some examples. Also, you can make a feature suggestion/request in the Features section for the new token.

Would be great to have some examples on how to create these custom tokens.

I also will submit a feature/suggestion request.
Thanks Bogdan!

This would be a great feature. Would it be possible to send myself and example?

I’ve put in a suggestion/request so you can upvote it if you like.

1 Like

Hi @ding, if you are interested in creating custom tokens, you can check this example here:

// Create Custom Pro Report tokens
add_filter( 'mainwp_pro_reports_tokens_groups', 'mycustom_reports_tokens_groups' );
function mycustom_reports_tokens_groups( $tokens ) {
       // examples
       $tokens['plugins']['sections'][] = array( 'name' => 'section.plugins.custompluginsection', 'desc' => 'Custom plugin section descriptions' );
       $tokens['plugins']['nav_group_tokens']['custompluginsection'] = 'Custom plugin section';
       $tokens['custompluginsection'][] = array( 'name' => 'plugin.custompluginsection.tokenname1', 'desc' => 'Token1 name descriptions' );
       $tokens['custompluginsection'][] = array( 'name' => 'plugin.custompluginsection.tokenname2', 'desc' => 'Token2 name descriptions' );
       return $tokens;


// token values
add_filter('mainwp_pro_reports_custom_tokens', 'mycustom_reports_custom_tokens');
function mycustom_reports_custom_tokens($tokens_values, $report) {
       $tokens_values['[plugin.custompluginsection.tokenname1]'] = 'Value for custom token name1';
       $tokens_values['[plugin.custompluginsection.tokenname2]'] = 'Value for custom token name2';
       return $tokens_values;

The example snippet is how to add a static token. But to get information out of child sites and in this case WordFence, I need to pull out dynamic data. I’ve read the documentation but I cannot find anything on how to do that.

I did a further search on this forum and came across this post which is exactly the same question I have: Custom report token with data from child site

Any of the developers able to give pointers on where to start?