Title: Require Capability to View Analytics (Feature Request &amp; Hack)
Last modified: August 31, 2016

---

# Require Capability to View Analytics (Feature Request & Hack)

 *  Resolved [uamv](https://wordpress.org/support/users/uamv/)
 * (@uamv)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/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://wordpress.org/plugins/lara-google-analytics-dashboard-widget/](https://wordpress.org/plugins/lara-google-analytics-dashboard-widget/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Amr M. Ibrahim](https://wordpress.org/support/users/amribrahim/)
 * (@amribrahim)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/require-capability-to-view-analytics-feature-request-hack/#post-7322321)
 * UaMV,
 * Thanks for your nice comments .. really appreciated!
 * Thanks to you, I’ve just release a fix for that ‘v1.0.4’, by **replacing** :
 * > `if ( 'index.php' != $hook ){`
 * **to**
 * > `if ( 'index.php' != $hook || !current_user_can('manage_options')) {`
 * As this will also prevent the loading of the js & css files.
 * On a side note, in future versions there will be a complete permissions system.
 * Thanks,
    Amr
 *  Thread Starter [uamv](https://wordpress.org/support/users/uamv/)
 * (@uamv)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/require-capability-to-view-analytics-feature-request-hack/#post-7322345)
 * Nice! Thank you for the quick response. Will an update notification come through
   for the Pro version? When I purchased, I don’t think any account was setup by
   which I could downloaded an updated version.
 *  Plugin Author [Amr M. Ibrahim](https://wordpress.org/support/users/amribrahim/)
 * (@amribrahim)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/require-capability-to-view-analytics-feature-request-hack/#post-7322436)
 * Yes, you’ll be notified by email. Soon, we’ll be implementing an auto-update 
   feature for the pro-version too.
 *  Thread Starter [uamv](https://wordpress.org/support/users/uamv/)
 * (@uamv)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/require-capability-to-view-analytics-feature-request-hack/#post-7322437)
 * Excellent! Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Require Capability to View Analytics (Feature Request & Hack)’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/lara-google-analytics-dashboard-widget_d0e3ef.
   svg)
 * [Lara, Google Analytics Dashboard Widget](https://wordpress.org/plugins/lara-google-analytics-dashboard-widget/)
 * [Support Threads](https://wordpress.org/support/plugin/lara-google-analytics-dashboard-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/lara-google-analytics-dashboard-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/lara-google-analytics-dashboard-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/lara-google-analytics-dashboard-widget/reviews/)

## Tags

 * [capability](https://wordpress.org/support/topic-tag/capability/)
 * [feature](https://wordpress.org/support/topic-tag/feature/)
 * [request](https://wordpress.org/support/topic-tag/request/)

 * 4 replies
 * 2 participants
 * Last reply from: [uamv](https://wordpress.org/support/users/uamv/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/require-capability-to-view-analytics-feature-request-hack/#post-7322437)
 * Status: resolved