How to show custom profile fields in a template file?
I am trying to display custom profile fields within the group members loop (bp_group_has_members()), and have tried 2 different template tags that I found in other forum threads, but neither returns any data.
Here are the two modes I’ve tried:
xprofile_get_field_data( ‘Email’ ); where ‘Email’ is the name of the field on the form
bp_member_profile_data( ‘field_5′); where ‘field_5′ is the field’s ID
Does anyone know what I’m doing wrong? Or how to solve this problem?
I’m having the same issue and can’t find anything to help. I looked at: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/
and http://buddydev.com/buddypress/fetching-and-showing-only-specific-fields-from-buddypress-xprofile-data/ but none of them seem to be working for me. If you figure it out please post back. Cheers
Not sure I understand your statement ” can’t find anything to help”? what is you other thread about then? and if the help that you are getting in that thread isn’t working why haven’t you posted back to that thread.
We can’t magic up code for you we can help you in the right direction, we all have things like this we are trying to solve or work out sometimes it does take a bit of time to get there.
field_5 cannot be the field ID they are numeric so not sure where you have got that idea, did you simply copy an example from the codex loop page/
Read the thread I linked to, not necessarily the solution you are all after but should help. As for simply displaying a particular field it’s a relatively trivial matter and should be clear how in that thread.
I’m using buddypress 126.96.36.199 (latest version) and wordpress 3.0.1(latest version).
What i’ve done so far: I’ve gone to ‘Profile Field Setup’ on the WordPress Dashboard under the Link ‘Buddypress’ and added the fields ‘Business Type’ with a drop down box of three options – DJs, Venue or Promoter. So when users register they choose one of these business types. I wanted these to show up on the members directory so put in to members-loop.php this code:
//code inside the members-loop.php
$business_type= xprofile_get_field_data( “Business Type” ,bp_get_the_site_member_user_id());//fetch the text for business type
and i’ve tried:
Anyone have any idea where i’m going wrong?
I think the code is much easier then what you came up with.. I’m currently not at my mac, but I’ll check it out in an hour or so, I should have the code somewhere
I’ve got it! On members-loop.php i’ve put:
Business Type: “
So now all if have to figure out is who to get the ‘order by’ drop down menu on Members director to pick up this Business Type field and work! Check out http://www.ineedyourskills.co.uk/members/ to see.
You are now running two concurrent threads on the same subject, please don’t. Why have you not simply continued in the original thread? this practice causes confusion and wastes resources.
Did you actually try my half baked example? where did you get the example above from?
Please continue this in the original thread where my examples do work in the members loop
@bowromir if you have code to help can you post it to the thread I linked to above.
Are you deliberately ignoring the other post Dorethy
I gave you that exact example for:
bp_member_profile_data( ‘field=business type’)
Please take a care not to make those that try and help feel as though they are wasting their time
Thread closed! As I asked please continue in the original one you started.
- The topic ‘How to show custom profile fields in a template file?’ is closed to new replies.