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.

I'm trying to show profile fields with checkboxes and drop-downs in the members directory loop.

Example: Next to each member in the directory I want to show the Gender they selected

This code works for text fields:

echo xprofile_get_field_data('Full Name', bp_get_member_user_id());

BUT how do I echo profile fields for drop-downs or checkboxes (unserialized data)?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

I believe xprofile_get_field_data is unserializing the data for you, but it is still in an array.

xprofile_get_field_data can return an array or a comma-separated string.

xprofile_get_field_data( $field, $user_id = 0, $multi_format = 'array' )

@param string $multi_format

  • How should array data be returned?
  • 'comma' if you want a comma-separated string
  • 'array' if you want an array
share|improve this answer
I'm a bit confused. Is this code for a single user which I have to specify his user Id? Because I want this to output the Gender selectbox field for all members. I'm making gender a requirement so I need it for everyone to show in the members loop. –  Aliyah Oct 17 '12 at 14:12
Also, where would I specify the actual name of the field? –  Aliyah Oct 17 '12 at 14:13
Thanx, Ive got it working now –  Aliyah Oct 17 '12 at 14:35

Got it working. Wrap the profile fields in a profile loop within the members loop and the data will output properly, just as it would inside of the profile loop.

<?php while ( bp_members() ) : bp_the_member(); ?>
<?php bp_member_profile_data( 'field=Gender' );?>
<?php endwhile; ?>
share|improve this answer

Have a look at the new plugin "Buddypress Xprofile Custom Fields Type" http://wordpress.org/extend/plugins/buddypress-xprofile-custom-fields-type/

share|improve this answer
Thanx mirage, its a useful plugin but im looking for a way to unserialize profile data and display it. –  Aliyah Oct 16 '12 at 7:50
found this solution on buddypress.org: $platforms = xprofile_get_field_data('Plattformen'); $data = xprofile_format_profile_field('checkbox', $platforms); echo $data; –  mirage Oct 16 '12 at 8:42
That didnt work. Did you test it yourself? Is there more discussion about it that I can have a look at? –  Aliyah Oct 16 '12 at 20:35
Here is the link: buddypress.org/community/groups/how-to-and-troubleshooting/… –  mirage Oct 16 '12 at 20:50
I think the process has chaned in the new BP as this isnt working –  Aliyah Oct 16 '12 at 21:40

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.