Skip to:
Content
Pages
Categories
Search
Top
Bottom

Using BP Member Profile Data outside members section


  • applegateian
    Participant

    @applegateian

    Hey guys

    I’m using bp_member_profile_data to get extended profile fields like location, about, education,etc. This all works fine within a members profile page.

    I want to use this in a sidebar on a page outside of the /members section, within the root of the site. It doesn’t seem to show any data when I include it elsewhere.

    Is there a way to do this outside?

    Thanks,

    Ian

Viewing 9 replies - 1 through 9 (of 9 total)

  • modemlooper
    Moderator

    @modemlooper

    bp_get_profile_field_data( array(‘user_id’=>$user_id,’field’=>$field ));


    applegateian
    Participant

    @applegateian

    Thanks Modernlooper. I’m using “ to link back to the users profile from outside of members. However, I am not sure with your code how to connect the field with the post author’s user id.

    Any ideas?


    modemlooper
    Moderator

    @modemlooper

    Use:

    bp_displayed_user_id
    bp_loggedin_user_id

    Or you use the WP post author id if you want to show profile data on post or bbPress topics.

    This really needs a function with logic. Example, bp_user_id() could give you id based on content.


    applegateian
    Participant

    @applegateian

    Thanks so much for the reply.

    When I manually add a user id I get the result I want:

    `echo xprofile_get_field_data(‘About you’, ‘2’);`

    However, when I try and use the options you provided above, it comes up blank. Is there something wrong with my implementation:

    `echo xprofile_get_field_data(‘About you’, ‘bp_displayed_user_id ()’)`
    or
    `echo xprofile_get_field_data(‘About you’, ‘bp_user_id ()’)`

    Thanks,

    Ian


    danbpfr
    Participant

    @chouf1

    `Try this`

    `$current_user = wp_get_current_user();
    $current_user_id = $current_user->ID;
    bp_profile_field_data( array('user_id'=>$current_user_id,'field'=>'About me' ));
    `


    applegateian
    Participant

    @applegateian

    Thanks – that works for showing the current logged in user’s data – that’s a breakthrough!

    What I need to show though is the author of the post’s id – is that achievable?


    danbpfr
    Participant

    @chouf1

    `query_posts($query_string . ‘&author=’. $user_id);`


    applegateian
    Participant

    @applegateian

    Thanks @chouf1 and excuse my ignorance, but where do I add

    `query_posts($query_string . ‘&author=’. $user_id);`

    to

    ` $current_user = wp_get_current_user();
    $current_user_id = $current_user->ID;
    bp_profile_field_data( array(‘user_id’=>$current_user_id,’field’=>’About me’ ));`


    applegateian
    Participant

    @applegateian

    Can anyone help with the above? Cheers

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Using BP Member Profile Data outside members section’ is closed to new replies.
Skip to toolbar