• Resolved Austin

    (@austyfrosty)


    Just advising a notice I am receiving.

    PHP Notice:  WP_Admin_Bar::add_node was called with an argument that is <strong>deprecated</strong> since version 3.3! Use <code>my-account</code> as the parent for the <code>switch-back</code> admin bar node instead of <code>my-account-with-avatar</code>

    https://www.ads-software.com/plugins/user-switching/

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Hi Autsin,

    Which version of WordPress are you using? And which version of User Switching?

    John

    Thread Starter Austin

    (@austyfrosty)

    WP 3.9.1 as listed to the right. Currently the latest version of US (0.9). It’s trigged when switching off or switching users.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Are you running a plugin which hides the user profile menu from the admin toolbar?

    Thread Starter Austin

    (@austyfrosty)

    No, clean local install.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    I don’t know what’s going on here then.

    Ref: https://github.com/johnbillion/user-switching/blob/0.8.8/user-switching.php#L290

    If that line evaluates to false then you’re either running an older version of WordPress, or a version which has been modified, or something is hiding or altering the user profile menu in the admin toolbar. If none of those are true, then, I’m a bit stumped!

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Austin, are you using the “TGM Plugin Activation” class in your theme?

    Thread Starter Austin

    (@austyfrosty)

    No.

    Thread Starter Austin

    (@austyfrosty)

    Here is the full error stack:

    [02-Jul-2014 14:56:23 UTC] PHP Notice:  WP_Admin_Bar::add_node was called with an argument that is <strong>deprecated</strong> since version 3.3! Use <code>my-account</code> as the parent for the <code>switch-back</code> admin bar node instead of <code>my-account-with-avatar</code>. in /Users/.../wp-includes/functions.php on line 3193
    [02-Jul-2014 14:56:23 UTC] PHP Stack trace:
    [02-Jul-2014 14:56:23 UTC] PHP   1. {main}() /Users/.../index.php:0
    [02-Jul-2014 14:56:23 UTC] PHP   2. require() /Users/.../index.php:17
    [02-Jul-2014 14:56:23 UTC] PHP   3. require_once() /Users/.../wp-blog-header.php:16
    [02-Jul-2014 14:56:23 UTC] PHP   4. include() /Users/.../wp-includes/template-loader.php:74
    [02-Jul-2014 14:56:23 UTC] PHP   5. get_footer() /Users/.../wp-content/themes/tipglo-2/template/subscribe.php:266
    [02-Jul-2014 14:56:23 UTC] PHP   6. locate_template() /Users/.../wp-includes/general-template.php:89
    [02-Jul-2014 14:56:23 UTC] PHP   7. load_template() /Users/.../wp-includes/template.php:477
    [02-Jul-2014 14:56:23 UTC] PHP   8. require_once() /Users/.../wp-includes/template.php:501
    [02-Jul-2014 14:56:23 UTC] PHP   9. wp_footer() /Users/.../wp-content/themes/tipglo-2/footer.php:71
    [02-Jul-2014 14:56:23 UTC] PHP  10. do_action() /Users/.../wp-includes/general-template.php:2044
    [02-Jul-2014 14:56:23 UTC] PHP  11. call_user_func_array() /Users/.../wp-includes/plugin.php:470
    [02-Jul-2014 14:56:23 UTC] PHP  12. wp_admin_bar_render() /Users/.../wp-includes/plugin.php:470
    [02-Jul-2014 14:56:23 UTC] PHP  13. do_action_ref_array() /Users/.../wp-includes/admin-bar.php:77
    [02-Jul-2014 14:56:23 UTC] PHP  14. call_user_func_array() /Users/.../wp-includes/plugin.php:546
    [02-Jul-2014 14:56:23 UTC] PHP  15. user_switching->action_admin_bar_menu() /Users/.../wp-includes/plugin.php:546
    [02-Jul-2014 14:56:23 UTC] PHP  16. WP_Admin_Bar->add_menu() /Users/.../wp-content/plugins/user-switching/user-switching.php:305
    [02-Jul-2014 14:56:23 UTC] PHP  17. WP_Admin_Bar->add_node() /Users/.../wp-includes/class-wp-admin-bar.php:74
    [02-Jul-2014 14:56:23 UTC] PHP  18. _deprecated_argument() /Users/.../wp-includes/class-wp-admin-bar.php:140
    [02-Jul-2014 14:56:23 UTC] PHP  19. trigger_error() /Users/.../wp-includes/functions.php:3193

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Thanks Austin. Is ‘tipglo-2’ a theme I can download from somewhere? A cursory Google doesn’t bring up anything.

    If you’re not running any plugins then there must be something in the theme which is messing with the admin bar. It’s possibly the same issue mentioned here: https://github.com/thomasgriffin/TGM-Plugin-Activation/pull/208/ (the plugin is incorrectly trying to un-hook and re-hook wp_admin_bar_render).

    Thread Starter Austin

    (@austyfrosty)

    Okay, that helps. I’ve tracked down the issue. I’ll see what I can change to get it working properly and post that later today.

    Thanks.

    Thread Starter Austin

    (@austyfrosty)

    Here is the class I have modifying the Admin Bar: https://gist.github.com/thefrosty/4eb774ab98c31885840e

    Thread Starter Austin

    (@austyfrosty)

    Looks like what it comes down to is an error being generated when the admin bar is shown by default to logged out users.

    add_filter( 'show_admin_bar', '__return_true' );
    Thread Starter Austin

    (@austyfrosty)

    I’m thinking a check needs to be made to user-switching.php:305 if a user is logged in or the $parent page exists/is loaded.

    I added this and the error has stopped:

    if ( !is_admin_bar_showing() ) {
    	return;
    }
    if ( !is_user_logged_in() ) {
    	return;
    }
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘PHP notice’ is closed to new replies.