Quick question:
Does Buddypress have a function like the WP function “get_userdata()” , where I can pass only the user_id and all the Buddypress profile info is returned as an object? And I can then use $object->field_name to get the data?
For example, something like this :
$data = bp_return_all_profile_info ($user_id); echo $data->location; echo $data->job; etc.
Thanks guys!
Hello Michael,
Thank you for posting. There is no similar function available in BuddyPress which returns all field info as a single object. But you can use the BuddyPress profile loop to fetch all the user profile details. Check the following link for reference:
https://codex.buddypress.org/developer/loops-reference/the-profile-fields-loop-bp_has_profile/
To get a user’s specific field data, you can use the function ‘xprofile_get_field_data’. Please check.
Regards
Ravi
The topic ‘ [Resolved] Coding question: get_userdata() similar function for Buddypress?’ is closed to new replies.