This snippet should be added to
Note : You will have to adapt this function for your needs by changing the name of the fields Location and Specialization from the example shown. Field names are case sensitive and must match exactly.
$location = bp_get_member_profile_data('field=Location');
$specialization = bp_get_member_profile_data('field=Specialization');
field=Location represents name of the field that we need to show in the member directory
field=Specialization represents name of another field that we need to show in the member directory