bp_get_member_profile_data() and xprofile_get_field_data() for current profile not logged in member

So fairy simple question I think. Currently I have a popup form on the profile page of members, and I want the dynamic details there to be the details of that member whose page the user is on, but instead right now I'm getting the logged in user's member details.

Using function xprofile_get_field_data() and bp_get_member_profile_data()

  • Div Truth
    • Design Lord, Child of Thor

    Not sure I understand your response. There is a simple answer, or like most of the buddypress documentation there's not a simple answer to be found?

    Was there something in my question that I left out that you would need?

  • Mason
    • DEV MAN’s Sidekick

    Hiya Nick,

    You're right the BuddyPress documentation is a bit lacking. You'll probably want to look at the BuddyPress default theme. Specifically, checkout:
    bp-default/members/single/member-header.php and
    bp-default/members/single/home.php

    You're probably looking for functions like:
    bp_displayed_user_fullname();

    Also you can pass the name of your profile fields like so:
    bp_profile_field_data( 'field=About Me' );

    Does that help?

  • Div Truth
    • Design Lord, Child of Thor

    Thanks for the response Mason, I actually tried that along with many others including what seemed promising

    $bp->displayed_user->id vs $bp->loggedin_user->id

    But for some reason I was still getting the loggedin_user ID, so I ended up passing the displayed user id through the URL and then getting any details I needed like so

    $company_id = $_REQUEST['id'];
    echo xprofile_get_field_data( 'Company Name', $company_id);

    Unless there is a better way this seems to work for now so that I can accomplish what I needed to. If you would like specific details or to see an example you would need to PM because it is not something I can share publicly.

    Thanks again for the help

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.