Support » Plugin: Google Analytics Dashboard » Fix for PHP notice

  • Simon Wheatley


    Code for the People


    When I run this plugin I see an error:

    Notice: has_cap was called with an argument that is <strong>deprecated</strong>
    since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles
    and capabilities instead. in /srv/www/wordpress-default/wp-includes/functions.php
    on line 2923

    This is caused by line 70 in gad-admin-options.php, which specifies a user level 8 when adding the options page. User level 8 is equivalent to an administrator, so replacing 8 with manage_options will work just as well.

    Here’s a gist with a patch:

    Hope this helps.



Viewing 3 replies - 1 through 3 (of 3 total)
  • Simon Wheatley


    Code for the People

    Here’s another notice I, errr, noticed…

    When I go to authenticate, I see the following error:

    Notice: Undefined variable: gauth in
    on line 279

    This is caused by trying to pass $gauth into GADAdminOptionsUI::display_admin_handle_login_options, when that variable does not exist in that context.

    Here’s a gist with some options for patching:

    Hope this helps.

    Hi Carson,

    Great plugin, appreciate your efforts in developing this! Concerning the errors mentioned above, I’m curious to know whether it is still under active development and whether you plan on releasing an update with these fixes included? I’ve applied both of the suggested patches above and the PHP notices are now gone. However I encountered another one, pertaining to the dashboard widget…

    Notice: Undefined index: dashboard_gad in /wp-admin/includes/dashboard.php on line 130

    Changing wp_register_sidebar_widget() to wp_add_dashboard_widget() in gad-admin-dashboard.php seems to resolve it…




    Just as an FYI, you must turn on: define('WP_DEBUG', true); in wp-config.php to see these errors/notices.

    Please fix them in the plugin devs!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fix for PHP notice’ is closed to new replies.