xprofile field everywhere in the website

Hello,

I’m trying to call an xprofile field that is in my personalised sidebar, with the following code :

<?php echo xprofile_get_field_data(‘9’:wink:; ?>

the problem is that if the member is not in the members section we don’t see it, does someone have an idea ?

Thanks in advance,

Oli

  • Timothy
    • Chief Pigeon

    Hey there.

    When you’re in the member pages the arg is optional, but when your elsewhere and outside of the member loop then you need to give it the UID for the user in a second arg like:

    <?php echo xprofile_get_field_data('9', 'UID'); ?>

    It also takes a third arg if you’re interested:

    $multi_format How should array data be returned? ‘comma’ if you want a * comma-separated string; ‘array’ if you want an array

    Take care.

  • farandhigh
    • WPMU DEV Initiate

    Hello Timothy,

    thanks for the quick answer,

    it wasnt working with ‘UID’ exactly writen like that, but you point me in the good direction and it worked like a charm with bp_loggedin_user_id() as second instance,

    tht I think is what you might mean ?

    Cheers and thanks ,

    Oli

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.