WordPress.org

Support

Support » Plugins and Hacks » [Plugin: User Avatar] Avatar not displaying on Author Page

[Plugin: User Avatar] Avatar not displaying on Author Page

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor enej
    Member

    @enej

    To display the avatar you need to use get_avatar() function http://codex.wordpress.org/Function_Reference/get_avatar

    Hope that helps

    Hi there, thanks for the reply.
    I am using the get_avatar() function, however it is still not working.
    i’ve tried it with:
    echo get_avatar( get_the_author_meta('ID'), 150 );
    and
    echo get_avatar(get_the_author_meta('user_email', $curauth->post_author), 150);

    Hi flashpunk,

    did you solve your problem? I am stuck with the same problem.

    Cheers.

    flashpunk
    Member

    @flashpunk

    Sorry, never fixed this issue.

    Mostafa Maklad
    Member

    @mostafamaklad

    You can use this code inside the loop
    <?php echo get_avatar(the_author_meta('ID'), 120);?>
    and you can use this outside the loop

    <?php
    global $post;
    $author_id=$post->post_author;
    echo get_avatar($author_id, 120);
    ?>

    Hey, I’m digging up this thread, just in case somebody found a solution to the problem.
    I can’t get the image to show up in the author page, the gravatar somehow takes priority on it and the url shown is that of the gravatar, not the custom user image.
    Basically, this is my author page :

    <?php
    /*
    Template Name: Auteur
    */
    get_header(); ?>
    
    <!-- This sets the $curauth variable -->
    
        <?php
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
        ?>
    
    <div id="content" class="<?php echo $curauth->user_nicename; ?>">
        <h1><?php echo $curauth->nickname; ?></h1>
        <dl>
            <dt>Site internet : </dt>
            <dd><a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a></dd>
            <dt>Biographie : </dt>
            <dd><?php echo $curauth->user_description; ?></dd>
        </dl>
        <h2>Les articles de <?php echo $curauth->nickname; ?> :</h2>
        <ul>
    <!-- The Loop -->
    
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <li>
                <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
                <?php the_title(); ?></a>,
                <?php the_time('d M Y'); ?> dans <?php the_category('&');?>
            </li>
    
        <?php endwhile; else: ?>
            <p><?php _e('Aucun article trouv&eacute; pour cet auteur.'); ?></p>
    
        <?php endif; ?>
    
    <!-- End Loop -->
    
        </ul>
    
       <?php
    echo get_avatar(get_the_author_meta('ID'), 200);
    ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    (I was using the global $post code before, but I realized it actually didn’t matter, it’s working without it)
    The place where I have my call for the avatar is the only place where I can get the picture I want. If I try to place the code somewhere else, I get a blank image with an url from the gravatar website.
    I tried, of course, with the global $post.
    Nothing worked.
    So the image is stuck at the bottom of the page, which is, of course, not where I want it.
    What is wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: User Avatar] Avatar not displaying on Author Page’ is closed to new replies.