• Resolved uamv

    (@uamv)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Amr M. Ibrahim

    (@amribrahim)

    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

    (@uamv)

    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

    (@amribrahim)

    Yes, you’ll be notified by email. Soon, we’ll be implementing an auto-update feature for the pro-version too.

    Thread Starter uamv

    (@uamv)

    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.