[oik] plugins.co.uk

WordPress plugins and themes

  • Home
  • About
    • lazy shortcodes
    • smart shortcodes
    • oik base plugin
      • oik – donate
      • oik PayPal buttons
      • oik installation
      • oik Button Shortcode button
      • oik changelog
      • oik FAQ
      • oik plugins on SVN
      • oik plugins on GitHub
  • Plugins
    • oik base plugin
    • FREE oik plugins
    • WordPress plugins
    • Premium oik plugins
    • Bespoke oik plugins
  • Shortcodes
    • Shortcode examples
  • Blocks
    • Block examples
  • APIs
    • ALL action and filter hooks
  • Blog

oik_admin_bar_menu() – Implements "admin_bar_menu" action for oik

You appear to be a bot. Output may be restricted

Description

Implements "admin_bar_menu" action for oik

We implement this first for the whole site…

Usage

oik_admin_bar_menu( $wp_admin_bar );

Parameters

$wp_admin_bar
( WP_Admin_Bar ) required – the WP_Admin_Bar object

Returns

void

TO DO

but allow each user to override it in oik-user?

  • This action hook runs after other action hooks to alter the "Howdy," prefix for 'my-account'.
  • Most howdy replace plugins look for the string "Howdy," so the code won't work if the string has already been translated.
  • We look for the translated version, which includes the user's display name.
  • So this logic should work for localized versions.
  • However, WordPress keeps changing the code.
  • Which has caused it to stop working in both 4.7 and 4.8.
  • See WordPress TRACs 37794 and 40342.

The structure we're changing is the node for 'my-account'. e.g.

[id] => my-account 
[parent] => top-secondary 
[title] => Howdy, <span class="display-name">vsgloik</span><img alt='' onerror='this.src="http://qw/wordpress/wp-content/themes/rngs0721/images/no-avatar.jpg"' src='http://1.gravatar.com/avatar/1c32865f0cfb495334dacb5680181f2d?s=26&d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D26&r=G' class='avatar avatar-26 photo' height='26' width='26' /> 
[href] => http://qw/wordpress/wp-admin/profile.php 
[meta] => Array 
( 
[class] => with-avatar 
[title] => My Account 
) 
 `  

Source

File name: oik/oik.php
Lines:

1 to 14 of 14
function oik_admin_bar_menu( &$wp_admin_bar ) {
  $replace = bw_get_option( "howdy" );
  if ( $replace ) {
    $node = $wp_admin_bar->get_node( 'my-account' );
    $current_user = wp_get_current_user();
    $howdy = sprintf( __('Howdy, %s'), '<span class="display-name">' . $current_user->display_name . '</span>' );
    //bw_trace2( $node, "node: $howdy" );
    $replace = $replace . " " . '<span class="display-name">' . $current_user->display_name . '</span>';
    if ( $node && $node->title ) {
      $node->title = str_replace( $howdy, $replace, $node->title );
      $wp_admin_bar->add_node( $node );
    }
  }
}
 

 View on GitHub View on Trac

Published: February 2, 2018 | Last updated: February 2, 2018

Plugins

  • All Plugins
  • oik base plugin
  • FREE oik plugins
  • WordPress plugins
  • Premium oik plugins

Themes

  • FREE themes
  • Bespoke themes
  • Premium themes

Blocks

  • All Blocks
  • Block examples
  • About Blocks

Shortcodes

  • All Shortcodes
  • Shortcode examples
  • About Shortcodes

Reference

  • About APIs
  • All APIs
  • All Classes
  • All Files
  • All Hooks

Support

  • Contact
  • Cookies policy
  • Get API key
  • Privacy
  • Request support
  • Sitemap
  • Stay informed
  • Terms and Conditions
oik-plugins
Email: herb@bobbingwide.com

Weight shipping plugins

Find out which cart weight shipping plugin you need for your WooCommerce site.
Which cart weight based plugin do I need?

Notice: genesis_footer_creds_text is deprecated since version 3.1.0! Use genesis_pre_get_option_footer_text instead. This filter is no longer supported. You can now modify your footer text using the Theme Settings. in /home/oikcouk/public_html/wp-includes/functions.php on line 4908

Site:  www.oik-plugins.co.uk
© Copyright oik-plugins 2011-2019. All rights reserved.


Website designed and developed by Herb Miller of Bobbing Wide
Proudly powered by WordPress and oik-plugins
WordPress 5.3.1. PHP: 7.3.12. Memory limit: 128M