[RESOLVED] Get Generic Xprofile Field Data
I’m trying to create an array of all xprofile fields (not specific to a user) created by the site admin. What’s the easiest way to get at that?
Thanks in advance for your help.
I solved this in what I think is probably the easiest way, using the global $groups like the loop in bp-xprofile-admin.php does within the function xprofile_admin(). It’s a pretty simple statement after all.
$groups = BP_XProfile_Group::get( array(
‘fetch_fields’ => true
$xprofile_field_names_build = array();
if ( !empty( $groups ) ) : foreach ( $groups as $group ) :
if ( !empty( $group->fields ) ) : foreach ( $group->fields as $field ) :
// Load the field
$field = new BP_XProfile_Field( $field->id );
$field_to_array = array(
‘key’ => $field->id,
‘value’ => $field->name
$xprofile_field_names_build = $field_to_array;
endforeach; // end $group->fields as $field
endif; // end $group->fields
endforeach; //end $groups as $group
endif; //end $groups`
However, if someone has a better way, I’d be glad to know of it.
- The topic ‘[RESOLVED] Get Generic Xprofile Field Data’ is closed to new replies.