PHP notice
-
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>
-
Hi Autsin,
Which version of WordPress are you using? And which version of User Switching?
John
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.
Are you running a plugin which hides the user profile menu from the admin toolbar?
No, clean local install.
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!
Austin, are you using the “TGM Plugin Activation” class in your theme?
No.
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:3193Thanks 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).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.
Here is the class I have modifying the Admin Bar: https://gist.github.com/thefrosty/4eb774ab98c31885840e
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' );I’m thinking a check needs to be made to
user-switching.php:305if a user is logged in or the$parentpage exists/is loaded.I added this and the error has stopped:
if ( !is_admin_bar_showing() ) { return; } if ( !is_user_logged_in() ) { return; }
The topic ‘PHP notice’ is closed to new replies.