BP Corporate - Placing Buddypress Avatars next to post titles

I would like to have buddypress avatars placed next to the titles of blog posts on my main blog.

I managed to do it with Thesis after a struggle and use the function on this sub blog , but not to sure how to do it with bp-corporate.

Can anyone help me with a few pointers?

Thanks,

George

  • Richie_KS
    • HummingBird

    hi georgef

    follow this step to add avatar to post.

    1. in index.php, archive.php, single.php or page.php..add this avatar call before

    < h1 class="post-title >

    <div class="post-avatar">
    <?php if(function_exists("bp_post_author_avatar")) : ?>
    <?php bp_post_author_avatar(); ?>
    <?php else: ?>
    <?php echo get_avatar($author_email,'32'); ?>
    <?php endif; ?>
    </div>

    2. and add this css to _inc/css/custom.css
    rename custom-sample.css to custom.css if you do not had one.

    #custom .post-avatar img {
    float: left;
    margin-right: 10px;
    border: 1px solid #ddd;
    padding: 5px;
    }

    #custom h1.post-title, #custom div.post-author {
    width: 85% !important;
    }

    that should do it:slight_smile:

    cheers

  • member1
    • The Incredible Code Injector

    I'm jumping in late here... let me know if I need to ask this in a new thread....thanks

    I'm using author avatar and author text link in my post title/byline area.
    I'd like to differentiate the avatar link from the text link by sending traffic to the author's bp profile page.
    Leaving the text link directing to the archive of author posts.

    I'm using this code:

    function byline_avatars() {
      echo get_avatar(get_the_author_id(), 30);
    }

    How would I modify it to link the avatar to the BP profile?
    Thanks
    Paul

  • Mason
    • DEV MAN’s Sidekick

    Hiya Paul,

    Are you using this with the bp communities theme?

    There's no easy configuration for this (yet) although buddypress has many listed here:
    http://codex.buddypress.org/buddypress-site-administration/changing-internal-configuration-settings/

    I think it'd be best to write a custom function for the author avatar link. Any custom code you create can be placed in a file called bp-custom.php. It gets loaded with all the rest of bp automatically during each page load. Just create the bp-custom.php file and drop it in /wp-content/plugins/.

    Hope this helps ya get started.

    Thanks!

  • member1
    • The Incredible Code Injector

    Hey Mason,
    Thanks for your reply.

    I'm actually using Thesis theme (for content blogs) and Buddypress default (community).
    I want to display the author avatar with profile link on the content blogs (Thesis) and adding to the custom-functions.php file. I've got some other code which is controlling the way the byline around the headline displays, so just wanted to add the author avatar link on those content pages.

    From the link above, here's 2 options that I could use in the wp-config file:

    define ( 'BP_AVATAR_DEFAULT', $img_url );
    define ( 'BP_AVATAR_DEFAULT_THUMB', $img_url );

    Any ideas how to change $img_url to allow for linking to the author's profile?

    thanks for your help
    Paul

  • Mason
    • DEV MAN’s Sidekick

    Hiya Paul,

    Actually those lines of code are for the default images so they won't help with the actual links.

    What you're trying to do is really a theme or BuddyPress modification. I don't have a copy of thesis myself so I can't really dive in and help ya there. Have you tried asking on their forums? I would think that would be the best place to get help on this one.

    Thanks!

  • towfiqi
    • Flash Drive

    I wanted to use the full version of the members avatar beside the posts, I tried this, but did not work:

    <?php bp_post_author_avatar('type=full'); ?>

    I want the bigger version of the uploaded image. Is there any other way to do this?

  • towfiqi
    • Flash Drive

    Never mind, got it. Had to write a custom function:

    function bp_custompost_author_avatar() {
       global $post;
    
       if ( function_exists('bp_core_fetch_avatar') ) {
            echo apply_filters( 'bp_post_author_avatar', bp_core_fetch_avatar( array( 'item_id' => $post->post_author, 'type' => 'full' ) ) );
      } else if ( function_exists('get_avatar') ) {
           get_avatar();
        }
      }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.