WordPress.org

Ready to get started?Download WordPress

Forums

User Avatar
Avatar not displaying on Author Page (7 posts)

  1. flashpunk
    Member
    Posted 3 years ago #

    Hi there,
    I'm using wordpress 3.2.1 with a few plugins, all of them up to date.

    I can't seem to get the Avatar created with this plugin to display on the Author page author.php.

    Any help would be appreciated!

    http://wordpress.org/extend/plugins/user-avatar/

  2. enej
    Member
    Plugin Contributor

    Posted 3 years ago #

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

    Hope that helps

  3. flashpunk
    Member
    Posted 3 years ago #

    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);

  4. urbanty
    Member
    Posted 3 years ago #

    Hi flashpunk,

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

    Cheers.

  5. flashpunk
    Member
    Posted 3 years ago #

    Sorry, never fixed this issue.

  6. Mostafa Maklad
    Member
    Posted 2 years ago #

    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);
    ?>
  7. Nessdufrat
    Member
    Posted 2 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic