Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How do you hide the admin details in a WP sidebar?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29213
    Johnny
    Member

    Hi Guys!
    First post on here so here goes…

    I have a list of gravatars in my sidebar that display all the authors as well as a text link (see image below – admin highlighted with a red outline). I want to hide the admin’s gravatar and link from appearing there and not sure how to do this.

    [img]http://i61.photobucket.com/albums/h70/magicdaps10/gravatars.jpg[/img]

    Really stuck on this one as I am pretty new to php so here is my code:

    I have this in my functions.php file:

    Code:
    function get_the_avatars_with_link_to_authors(){
    $authors = get_users_of_blog();
    foreach ($authors as $author){
    $author_data = get_userdata($author->user_id);
    $author_nicename = $author_data->user_nicename;
    $author_displayname = $author_data->display_name;
    $link .= ‘

  • ID) . ‘” title=”‘ . sprintf( __( “View %s’s profile” ), $author_displayname ) . ‘”>’ . get_avatar($author_data->ID,$size = ’35’) . $author_displayname . ‘
  • ‘;
    }
    return $link;
    }

and in my sidebar.php file i have:

Code:

Somehow (and I don’t know how) I think I need to alter or add something to my function.php file?

Thanks in advance if anyone can help me out on this one. ;)

#77001
mattvot
Member
Code:
function get_the_avatars_with_link_to_authors(){
$authors = get_users_of_blog();
foreach ($authors as $author){
$author_data = get_userdata($author->user_id);
$author_nicename = $author_data->user_nicename;
$author_displayname = $author_data->display_name;
if( ! $author_data->user_level === 10 ){
$link .= ‘

  • ID) . ‘” title=”‘ . sprintf( __( “View %s’s profile” ), $author_displayname ) . ‘”>’ . get_avatar($author_data->ID,$size = ’35’) . $author_displayname . ‘
  • ‘;
    }
    }
    return $link;
    }

    #77051
    Johnny
    Member

    Cheers for trying for me MattVot but I used the code you posted and it just hides all the avatars.

    Thanks ;)

    Viewing 3 posts - 1 through 3 (of 3 total)