Recent Global Posts plugin + Avatars plugin

Hey Guys.

I’d like to modify the Recent Global Posts plugin to display the blog avatar (Avatars plugin) instead of the user avatar in the widget. Looks like the edit would be around line 104.

I’ve tried a few things but can’t seem to figure out how to make it work. Any hints?


Oh, actually, I think this might do it:

echo '<a href="' . $post['post_permalink'] . '">' . get_blog_avatar( $post['post_author'], $recentglobalpostsavatarsize, '' ) . '</a>';

I didn’t think it was working because I was posting as the super admin. Posting as a subscriber that has reg’d on a sub site seems to display that site’s avatar.

I guess sometimes it just helps to talk it out ;p

  • dubya
    • The Incredible Code Injector

    heh sometimes.

    Further testing would reveal that this code will show the blog avatar if the post is authored by the blog’s admin. Using front end posting by subscribers, it seems to revert back to thier user avatar.

    Any ideas on how to get it to show the originating blog’s avatar, regardless of who the poster is? One would ass/u/me that the key is in the part of the code that refrences the post_author.

  • dubya
    • The Incredible Code Injector

    Hey hey hey! I got it!

    Wow, I really struggled with this one. Here’s the code:

    echo '<a href="' . $post['post_permalink'] . '">' . get_avatar( get_blog_option($post["blog_id"], 'admin_email'), $recentglobalpostsavatarsize, '' ) . '</a>';

    Simply replace line 104 with this, and it will display the avatar associated with the admin email specified under settings=>general for each blog.

    I couldn’t figure out how to get the blog avatar, but this is the next best thing.

    Next time this plugin’s code is up for review… This would make for a nice option within the widget settings. :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.