• Hi Guys,

    First of all, thanks for the plugin! It really cool and simple to use. However, there’s this glitch tho:

    1. I manage a Multisite installation
    2. Widget dashboard was displayed perfectly on the main site
    3. Widget dashboard failed to be displayed on the sub-site

    The only clue I found:

    1. There’s this “datelabel” undefined message at the chrome console
    2. I checked the network tab of the inspector, it showed that the content was successfully fetched from wp_ajax
    3. I checked the screen option, there’s no “Google Analytics Summary” checkbox

    After checking the source code, here’s the conclusion and the fix:

    1. Google Analyticator checks which role that can see dashboard widget (google-analytics-summary-widget.php:44. Permission for the role can be configured from /wp-admin/options-general.php?page=google-analyticator.php The glitch is that in situation where super admin accessing sub-site, the super admin isn’t registered for the site but has access to it.
    2. The inline js (google-analytics-summary-widget.php:66) part doesn’t check for the user role
    3. The inline js fetches for the content while there’s no widget for that, hence the datelabel undefined state

    The solution:

    1. Check for the super admin capabilities before using Google Analyticator’s get dashboard check
    2. Applied the same conditional to the inline js part.

    Here’s how i did it, applied at google-analytics-summary-widget.php on line 44:

    if ( current_user_can( 'manage_network' ) || ga_current_user_is(get_option(key_ga_dashboard_role))) {

    and with slightly different approach on line 66 / addTopJs():

    if( !current_user_can( 'manage_network' ) && !ga_current_user_is( get_option( key_ga_dashboard_role ) ) ) {
                return;
    }

    https://www.ads-software.com/plugins/google-analyticator/

  • The topic ‘[Resolved] Dashboard Widget Bug on Multisite Settings’ is closed to new replies.