Require Capability to View Analytics (Feature Request & Hack)
-
Thanks for what is shaping up to be a great plugin! Integration and setup is quite easy.
I would like to see an option added that restricts viewing of analytics to users possessing a specific capability. Currently, subscribers to my site are able to view all analytics. I have hacked the plugin as follows for the time being, so that I can manage this via a filter.
Replaced Line 126 of
lara-google-analytics-dashboard-widget-pro.php:if ( current_user_can( apply_filters( 'lrga_read_analytics', 'read' ) ) ) { add_action( 'admin_notices', 'lrga_welcome_panel' ); }Add following filter to control capability:
add_filter( 'lrga_read_analytics', 'twxyz_restrict_analytics' ); function twxyz_restrict_analytics( $cap ) { return 'manage_options'; }Note: This is the line number in the Pro Version.
https://ww.wp.xz.cn/plugins/lara-google-analytics-dashboard-widget/
The topic ‘Require Capability to View Analytics (Feature Request & Hack)’ is closed to new replies.