Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

BuddyPress has a function (bp_member_profile_data) that pulls profile data into a members loop which looks like this:

bp_member_profile_data( 'field=Organization' );
bp_member_profile_data( 'field=Brief Biography' );  

* If you want to show specific profile fields here you can,
* but it'll add an extra query for each member in the loop
* (only one regardless of the number of fields you show):
* bp_member_profile_data( 'field=the field name' );   */

I'm wondering how to limit the echoed length of Brief Biography. I've looked at the Bavatosan example and substr but they're kind of beyond me at this point in terms of knowing where to modify them.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I think buddypress has a get* version of that function that returns the value instead of showing it on the screen.

So just cut the returned string after a certain amount of characters, like 50:

$profile_bio = bp_get_member_profile_data( 'field=Brief Biography' );

if(strlen($profile_bio) > 50))
  $profile_bio = substr($profile_bio, 0, 50).'...';

echo $profile_bio;

If there's no get function you can always use output buffering:

bp_member_profile_data( 'field=Brief Biography' );  
$profile_bio = ob_get_clean();

// rest of the code is the same
share|improve this answer
Perfect. Thanks very much! –  Christopher Dec 11 '11 at 19:13
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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