Search code examples
wordpressbuddypress

how to get fields from the profile information with bp_member_profile_data


I am having some difficulties on trying this buddypress code to work:

   <?php $args = array(
            'field'   => 'Location',   
            'user_id' => $curauth->ID           
        ); ?>
   <?php  bp_member_profile_data($args); ?> 

it just doesn't display anything for me. Am i doing something wrong?. I am running this code in the author wordpress page. Thanks very much for your help!


Solution

  • this should work:

    <?php 
     $location = xprofile_get_field_data( "Location" , $curauth->ID );  
    ?>
    

    actually it works for sure, cause I used it several times! :)

    I never used the function bp_member_profile_data($args) but I guess it works only inside a loop.

    I hope this helped!