Get xprofile field names for different member roles
This may be an easy question to answer (I’m hopeful), but I’ve been unable to find a solution to my problem so far. I’m currently using WordPress 4.3 with BuddyPress 220.127.116.11 installed on my server. I have Extended Profiles enabled, and am using the plugin BuddyPress xProfiles ACL to manage custom extended profile groups assigned by user role.
I have two roles that I am working with primarily – ‘students’ and ‘institutions’. Each of these roles have their own unique group of profile fields, some of which have the same name (e.g., each role has an ‘Address’ extended profile field). Within the bp_members loop, I am usually able to obtain a given user’s extended profile data by using the following function:
$value = xprofile_get_field_data($field, $user_id);
where $field is the name of the field I want to retrieve a value from in all lowercase letters (e.g., ‘Address’ would be ‘address’). I have run into an issue when trying to get field data from a profile field that has the same name for two separate user role groups. Using the same field name for both user roles will only return results for one of the roles (the role where that profile field was first created). I’m assuming the extended profile field for one of the user roles is being stored in the database with a slightly modified name, but I am unsure of how to retrieve this name.
Is there a way to request all xprofile field names for a given group of users (or even an individual user)? If I can obtain a list of the xprofile field names – or more specifically, a list of strings I could pass to the xprofile_get_field_data function – I should be able to get all the data I am looking for.
If you could please help me solve this problem, it would be greatly appreciated.
Thanks a lot,
- The topic ‘Get xprofile field names for different member roles’ is closed to new replies.