Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to show BP Xprofile fields in user results – Part 2 › Reply To: How to show BP Xprofile fields in user results – Part 2
March 26, 2024 at 11:49 am
#47583
Participant
Hmm, you’re right, it looks like the IP has changed. Sorry!
Great news, thank you! Do I still need the custom snippet with the latest version of the plugin? If so, can I leave it as it is at the moment?
add_filter('asp_user_advanced_field_value', 'asp_xprofile_user_advanced_field_value', 10, 3);
function asp_xprofile_user_advanced_field_value($value, $field, $user) {
if ( empty($value) ) {
global $bp;
$args = array(
'field' => $field,
'user_id' => $user->id
);
$data = bp_get_profile_field_data($args);
if ( !empty($data) ) {
var_dump($data);
return $data;
}
}
return $value;
}