Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created August 19, 2024 17:37
Show Gist options
  • Save andrewlimaza/17c64bedbda78c7f8abf47c8c805f0dc to your computer and use it in GitHub Desktop.
Save andrewlimaza/17c64bedbda78c7f8abf47c8c805f0dc to your computer and use it in GitHub Desktop.
When Last Login - User Statistics (Custom Role Filter)
<?php
/**
* Tweak the user capability required to view the When Last Login - User Statistics charts/reporting.
* This requires V1.1+ of When Last Login - User Statistics.
* Add this code to your site by following this guide - https://yoohooplugins.com/customize-wordpress/
*/
function my_wll_user_stats_admin_cap( $capability ) {
return 'edit_users'; // Change this to the custom capability value.
}
add_filter( 'wll_stats_access_cap', 'my_wll_user_stats_admin_cap', 10, 1 );
add_filter( 'wll_rest_api_caps', 'my_wll_user_stats_admin_cap', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment