pixeloft pixeloft - 1 year ago 99
PHP Question

BuddyPress avatar showing up outside designated content

I have a BuddyPress member loop that includes the user avatar. The avatar is showing up, but outside it's wrapping html element.

if ( bp_has_members( bp_ajax_querystring( 'members' ) ) ) :


while ( bp_members() ) : bp_the_member();

$content.="<li><a href='".bp_member_permalink()."'>".bp_member_avatar()."</a></li>";




$content.='You are not connected to any companies.';


The result is showing up with empty


And the avatars are there, but above the actual list.

enter image description here

Any help would be great!

Answer Source

This function will echo the avatar: bp_member_avatar(). So it will appear as your code runs, rather than append it to $content. Try using bp_get_member_avatar() instead.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download