BuddyPress Profile Data outside of the loop

Home / Tutorials / Plugins / BuddyPress Profile Data outside of the loop

BuddyPress Profile Data outside of the loop

This post will teach you how to fetch BuddyPress Xprofile field outside of the members loop.

BuddyPress is a powerful social network plugin for WordPress and in some instances it is necessary to call XProfile fields outside of the loop. To fetch the profile fields one will need the User ID and the field name/field ID. You can get the fields by using the the function xprofile_get_field_data

In the event that the profile field is a text field a string will be returned. In the case of multiple fields or checkboxes, an array will be returned.

Fetching Multiple Fields

Here is a quick way to fetch multiple xProfile fields

Creating shortcode with meta fields

In this section, we are going to take what we have created so far and create a shortcode that will display the logged in user’s profile.

Recommended Posts
  • cool! Do you know how to get the user cover image outside the loop to display with the user data in a sidebar for instance? I have searched everywhere and literally nowhere on the entire internet covers how to grab the cover image.

    Thanks.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search