0

I'm in the process of trying to integrate bootstrap with Buddypress and am trying to add a class of "media-object" to Buddypress avatars. I could do this by mimicking the Bootstrap CSS, but in the interest of learning new things is there a way to add a class, perhaps by using a filter?

The bp_loggedin_user_avatar is where the image is created. How can I hook into it and add a class?

<div id="whats-new-avatar media">
        <a class="pull-left" href="<?php echo bp_loggedin_user_domain(); ?>">
            <?php bp_loggedin_user_avatar( 'width=' . bp_core_avatar_thumb_width() . '&height=' . bp_core_avatar_thumb_height() ); ?>
        </a>
</div> 

1 Answer 1

0

When calling bp_loggedin_user_avatar(), you can set the 'html' attribute to false and it will return just the URL of the avatar (instead of the full HTML). Then you can style it how you want.

Something like:

$avatar_url = bp_loggedin_user_avatar( 'html=false' );
echo '<img class="media-object" src=' . $avatar_url . ' width="' . bp_core_avatar_thumb_width() . '" height="' . bp_core_avatar_thumb_height() . '"/>

Not the answer you're looking for? Browse other questions tagged or ask your own question.