Skip to:
Content
Pages
Categories
Search
Top
Bottom

Get Buddypress Profile Data in WordPress Page

  • Avatar of linish
    linish
    Participant

    @linish

    Hello All,

    I am new to buddy press. Currently I am working in a site which consists of Directory Press + S2Member + BuddyPress. My aim is to retrieve the value from buddypress profile fields on profile activation. Everything went fine till try to get the data from the profile field in buddy press

    When I searched the documentation says us to use the function `bp_profile_field_data`

    The following code works fine in the file profile-loop.php

    `bp_member_profile_data( ‘field=Company Name’ )`

    But when I use the same code in functions.php it shows blank

    Thanks
    Linish

Viewing 5 replies - 1 through 5 (of 5 total)
  • Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    Use :
    xprofile_get_field_data( “Company Name” , $member_id)
    You have to supply the $member_id

    If you’re on a profile page, the $member_id will be provided via bp_displayed_user_id()

    Take a look at
    /bp-xprofile/ -> bp-xprofile-functions.php -> xprofile_get_field_data

    Avatar of linish
    linish
    Participant

    @linish

    Hello,

    I had tried that but it will worked only on buddypress profile page, the same gave blank result in normal wordpress page / custom template for a page

    Avatar of shanebp
    shanebp
    Moderator

    @shanebp

    xprofile_get_field_data function is provided so that you CAN use it on non-profile pages.

    Use http://pastie.org/ or similar to show what you tried.

    Avatar of linish
    linish
    Participant

    @linish

    Hello,

    I had created the paste of the code i had tried both in profile-loop.php and in

    functions.php

    `http://pastie.org/6050342`

    The code is working fine in profile-loop.php but showing blank result in

    functions.php

    Avatar of linish
    linish
    Participant

    @linish

    Hello all,

    I solved the issue by using the hook `wpmu_activate_user`

    Thanks for the tips :)

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

You must be logged in to reply to this topic.