Remove Gravatar on Admin Bar (Hintergründe: http://talkpress.de/artikel/wordpress-admin-bar-datenkrake-missbrauch)
<?php | |
/** | |
* Plugin Name: Remove Gravatar on Admin Bar | |
* Plugin URI: http://talkpress.de/artikel/wordpress-admin-bar-datenkrake-missbrauch | |
* Description: Remove Gravatar on Admin Bar | |
* Version: 1.0.0 | |
* Author: Frank Bültge | |
* Author URI: http://bueltge.de | |
* License: GPLv3 | |
*/ | |
// This file is not called from WordPress. We don't like that. | |
! defined( 'ABSPATH' ) and exit; | |
// If the function exists this file is called as comments template. | |
// We don't do anything then. | |
if ( ! function_exists( 'fb_admin_bar_init' ) ) { | |
add_action( 'init', 'fb_admin_bar_init' ); | |
function fb_admin_bar_init() { | |
remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 0 ); | |
remove_action( 'admin_bar_menu', 'wp_admin_bar_my_account_item', 7 ); | |
add_action( 'admin_bar_menu', 'fb_admin_bar_my_account_menu', 0 ); | |
add_action( 'admin_bar_menu', 'fb_admin_bar_my_account_item', 7 ); | |
} | |
function fb_admin_bar_my_account_menu( $wp_admin_bar ) { | |
$user_id = get_current_user_id(); | |
$current_user = wp_get_current_user(); | |
$profile_url = get_edit_profile_url( $user_id ); | |
if ( ! $user_id ) | |
return; | |
$wp_admin_bar->add_group( array( | |
'parent' => 'my-account', | |
'id' => 'user-actions', | |
) ); | |
$user_info = "<span class='display-name'>{$current_user->display_name}</span>"; | |
if ( $current_user->display_name !== $current_user->user_nicename ) | |
$user_info .= "<span class='username'>{$current_user->user_nicename}</span>"; | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'user-actions', | |
'id' => 'user-info', | |
'title' => $user_info, | |
'href' => $profile_url, | |
'meta' => array( | |
'tabindex' => -1, | |
), | |
) ); | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'user-actions', | |
'id' => 'edit-profile', | |
'title' => __( 'Edit My Profile' ), | |
'href' => $profile_url, | |
) ); | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'user-actions', | |
'id' => 'logout', | |
'title' => __( 'Log Out' ), | |
'href' => wp_logout_url(), | |
) ); | |
} | |
function fb_admin_bar_my_account_item( $wp_admin_bar ) { | |
$user_id = get_current_user_id(); | |
$current_user = wp_get_current_user(); | |
$profile_url = get_edit_profile_url( $user_id ); | |
if ( ! $user_id ) | |
return; | |
$howdy = sprintf( __('Howdy, %1$s'), $current_user->display_name ); | |
$wp_admin_bar->add_menu( array( | |
'id' => 'my-account', | |
'parent' => 'top-secondary', | |
'title' => $howdy, | |
'href' => $profile_url, | |
'meta' => array( | |
'title' => __('My Account'), | |
), | |
) ); | |
} | |
} // end if |
This comment has been minimized.
This comment has been minimized.
ja, schon gelesen.
ich wollte die Abfrage erst abfangen, war mir dann aber zu unsicher, da man
ja nach Gravatar abfragt.
schön!
Liebe Grüße
Frank
…__
WordPress? Ich habe ein Buch geschrieben und ein Video erstellt:
http://wordpress-buch.bueltge.de/das-wordpress-buch/
http://wordpress-video-training.bueltge.de
http://bueltge.de : frank@bueltge.de
http://inpsyde.com : f.bueltge@inpsyde.com
__
Frank Bültge
Tel: +49 36428 169305
Mobil: +49 170 5322053
Inpsyde GmbH, http://inpsyde.com
Mutzer Heide 3, 51467 Bergisch Gladbach
Steuernr: 204/5756/0999
Steueridentnr.: DE263849534
Geschäftsführender Gesellschafter: Heinz Rohé
HRB 65224
Amtsgericht Köln
On Thu, Feb 2, 2012 at 1:34 PM, Dominik Schilling < ***@***.*** > wrote:
Alternative: https://gist.github.com/1723233
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/1723225
|
This comment has been minimized.
This comment has been minimized.
What's the |
This comment has been minimized.
This comment has been minimized.
Looks like not working in version 5.3.2. |
This comment has been minimized.
This comment has been minimized.
That's only a prefix for clear namespace to remove problems with other functions. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Alternative: https://gist.github.com/1723233