Omega get profile data

DescriptionBuddypress snippet by - 07/20/10

This function is from my Buddypress theme Omega, just call it using omega_get_profile_data(2,'birthday');

It will return the profile field contents that you specify, in this case 'birthday'. Be sure to create that field in the Buddypress profile setup.

Tags

<?php
// Get Profile Data
function omega_get_profile_data($user_id,$chosen_fieldname){
	if (bp_has_profile('user_id=' . $user_id)) : 
		while (bp_profile_groups()) : bp_the_profile_group(); 
			while (bp_profile_fields()) : bp_the_profile_field(); 
				if (bp_field_has_data()) : 
					$fieldname = bp_get_the_profile_field_name(); 
					if($fieldname == $chosen_fieldname){$return_value = strip_tags(bp_get_the_profile_field_value());}
				endif; 
			endwhile; 
		endwhile; 
	endif;

return $return_value;
}
?>
  • Share
Authored by: Adam J Nowak
http://hyperspatial.com

One Response to “Omega get profile data”

Comments and Feedback