WordPress.org

Ready to get started?Download WordPress

Forums

Avatars on a blog with multiple authors per post (2 posts)

  1. mcheater
    Member
    Posted 2 years ago #

    Hello,

    Our site (http://pseweb.ca) has many multi-author posts and we were leveraging both Co-Authors Plus as well as Gravatar to show the gravatar of the first author at the top of each post (hadn't figured out how to show the avatars of multiple authors yet ... ).

    Recently, the site started always showing my personal avatar rather than the (co)authors. I checked that the correct users are assigned as (co)authors on the posts.

    This is the code that we have pulling in the gravatar:
    <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentyten_author_bio_avatar_size', 46 ) ); ?>

    I looked in the source of the RSS feed for the content type (http://pseweb.ca/presentations/feed/) and saw that I was the "Creator" for all the posts - so I'm thinking that my template is pulling the creator's email address, rather than the (co)authors email address (Gravatar is based on email address).

    I tried changing get_the_author_meta to get_the_coauthor_meta, but it didn't work (sounds like this only works with WordPress 2.8).

    Some other notes:
    We recently upgraded WordPress to 3.1.2 - we also recently upgraded the Co-Authors Plugin.

    I am working a custom post type (presentations).

    Many of the "presentations" on the site had been assigned co-authors who were not me, but something caused many of them to switch from their assigned authors to me. I went in and re-assigned the correct authors but this didn't fix the problem - it's still pulling my info, rather than the assigned coauthors.

    If I use the_author() instead of the_coauthor(), I receive my information - even when I am not one of the coauthors. It's like my site is showing me the Co-Authors field instead of Author, but it is putting the creator of the post as the_author.

    I'm not attached to either gravatar or co-authors plus. My goal is to have multi-author posts that show avatar/display pics for all authors.

    Any help would be very appreciated!

  2. Mohammad Jangda
    Member
    Posted 2 years ago #

    The docs are a little outdated. get_the_coauthor_meta returns an array of the requested values for the coauthors, so calling get_the_author_meta( 'user_email' ) would return something like:


    array (
    [123] => 'abc@example.com',
    [456] => 'def@example.com'
    )

    where 123 and 456 are user ids.

    You can also just do a custom loop, using CoAuthorsIterator or get_coauthors() and a foreach loop. See http://wordpress.org/extend/plugins/co-authors-plus/other_notes/

Topic Closed

This topic has been closed to new replies.

About this Topic