• Resolved brasofilo

    (@brasofilo)


    Hi,
    I always have to hack the plugin to allow editors to access the dashboard stats.

    I propose the following modifications:

    In function a360_request_handler:

    $cap = apply_filters( 'a360_dashboard_capability', 'manage_options' );
    	if (!empty($_GET['a360_action']) && current_user_can( $cap )) {

    In function a360_admin_menu:

    First, remove the wrapper current_user_can, as add_*_page already has a capability.

    And then use this to the dashboard page:

    add_dashboard_page(
    	__('Dashboard', 'analytics360'),
    	__('Analytics360°', 'analytics360'),
    	apply_filters( 'a360_dashboard_capability', 'manage_options' ),
    	basename(__FILE__),
    	'a360_dashboard'
    );

    https://www.ads-software.com/extend/plugins/analytics360/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Good idea, you can create a pull request here:

    https://github.com/crowdfavorite/wp-analytics360

    Quiet an essential feature for many publishers like us.
    Can you please specify where exactly to insert the code, this is the only solution I found. Where to insert the function a360_request_handler exactly in the code?
    Appreciate your feedback.

    Thread Starter brasofilo

    (@brasofilo)

    @hitchb, I submitted a patch, hopefully it gets included in future releases.

    Meanwhile, you can change it in the file analytics360.php:

    – Change 2 occurrences of current_user_can in the function a360_request_handler.

    – And remove the if(current_user_can) from the function a360_admin_menu, and modify the capabilities for the dashboard page. It’ll look like:

    function a360_admin_menu() {
        add_options_page(
             __('Settings', 'analytics360'),
             __('Analytics360°', 'analytics360'),
             'manage_options',
             basename(__FILE__),
             'a360_settings_form'
        );
        add_dashboard_page(
             __('Dashboard', 'analytics360'),
             __('Analytics360°', 'analytics360'),
             'manage_options', // <------ CHANGE HERE
             basename(__FILE__),
             'a360_dashboard'
        );
    }

    @brasofilo: First of all, thanks a lot for your fast reply! I have been changing the file as requested. I simply copied the full file you submitted with the change you made. The menu appear now like this: https://awesomescreenshot.com/08a1tfcfcb

    Second, I don’t understand why the menu item analytics 360 doesn’t appear on our editor account:
    https://awesomescreenshot.com/05f1tfd110

    We also have the adminitize plugin installed as we manage a team of 30 writers plus 2 editors role. We want to display the analytics to our editors only. Do you have any idea why it doesn’t work?

    I think it’s something related to encoding ‘Analytics 360°’

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Feature request: add filter hook to allow editors viewing stats’ is closed to new replies.