How to add avatar to authors list?
How to add avatar to authors list?
How to add avatar to authors list?
One option is to use the pre_get_avatar filter to return custom avatar HTML, which will short-circuit get_avatar() preventing it from reaching out to Gravatar for the image. For example like this, add_filter(‘pre_get_avatar’, ‘wpse_410434_author_img_html’, 10, 3); function wpse_410434_author_img_html( $avatar, $id_or_email, $args ) { if ( $avatar || ! is_numeric( $id_or_email ) ) { return $avatar; } … Read more
I found the solution! global $current_user; get_currentuserinfo(); echo get_avatar( $current_user->ID, 48 );
A join to get the user role? I don’t think so. Since you’re into doing your own PHP (from the examples you’ve provided) do more research on the built in functions for what you’re looking to do in the WordPress Codex. As far as creating new roles the code below copies the Administrator role, removes … Read more
I’m not sure if core offers any hooks well suited to this purpose. I certainly don’t see any purpose-fit hooks in the source which renders the admin menu. But on a more hacky whim, this could be relatively easily accomplished using a add_menu_item() with $position 0, then modifying the new menu item registration in the … Read more
Possible sollutions: Use Css with something like overflow: hidden; and “cut out” what you need. Use the filter apply_filters(‘get_avatar’, $avatar, $id_or_email, $size, $default, $alt); and override the output of $avatar completely. The function get_avatar() is pluggable. That means if you hook a plugin function early enough that already defines get_avatar() then this function will be … Read more
You forgot to echo it: <?php echo get_avatar( $user->user_email, 150 ); ?>
The way gravatar works is that it creates an MD5 of the email address and passes that to gravatar.com. If an avatar exists for that hashed email address, then it gets returned. If not, then it generates a random one based on the data in the hash. Essentially, it’s arbitrary. There’s code in there that … Read more
There is a native WordPress function to do exactly what it sounds like you’re trying to do. You need to replace userphoto_thumbnail($user_info, $before=””, $after=””, $attributes = array(width => ’40’, height => ’40’), $default_src=””) with get_avatar($user_info->ID,40) Check here for your future reference – http://codex.wordpress.org/Function_Reference/get_avatar
Developer Tools show a “bad request” error, so switch to the twentyeleven theme to be sure it’s not a theme issue. And disable the W3TC plugin and see if anything changes.