Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to display custom profile field?


  • CriticalNed
    Participant

    @criticaltodd

    Is there a way to use template tags to display a single profile field?

    For example, I created a field “Title” and I’d like to display that alongside the user’s blog posts, so it would say “Posted by TestUser (<b>Title: Cool Guy</b>), on Jan 30…”

    As a test I tried <?php echo bp_get_field_data(3, 1); ?> where 3 is the custom field_id (“Title”) and 1 is the user_id. However, that failed to display anything.

    I’m thinking about just doing a custom MySQL query…

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

  • CriticalNed
    Participant

    @criticaltodd

    This one is up next on my development list, so I’ll just gratuitously BUMP this…

    Is anybody aware of a way to call specific profile fields using BP functions, or is the only way to do this something like:

    //get the country of the current post author. country field ID is 4.

    $result = mysql_query(“SELECT value FROM wp_bp_xprofile_data WHERE user_id = ” . $current_author . ” AND field_id = ” . $country_field . ” LIMIT 1″);

    $row = mysql_fetch_array($result);

    $profile_field = $row;

    Hmm, I may have just answered my own question…

    There is a function:

    <?php echo bp_get_field_data( $field_name, $user_id ) ?>


    Scotm
    Participant

    @scotm

    Andy

    Does this answer my question here: https://buddypress.org/forums/topic.php?id=610


    CriticalNed
    Participant

    @criticaltodd

    Thank you, Andy. I did try that function but I must have forgotten to echo it. FOLKS, don’t forget to echo your functions!!


    CriticalNed
    Participant

    @criticaltodd


    psfk
    Participant

    @psfk

    Can someone tell me how can I use this code in the bp-core-directory-members.php so that I can list say the name of the City each member lives in under their name?

    <?php echo bp_get_field_data( $field_name, $user_id ) ?>

    I can make the random call work – but I’d rather just call a certain profile field – see http://purplelist.com/members.


    psfk
    Participant

    @psfk

    Ah – I worked it out:

    <?php echo bp_get_field_data( 'One Line Summary', $user->user_id ) ?>


    psfk
    Participant

    @psfk

    Ah – ok. So I installed RC2 and the line failed…. any suggestions ?


    Archie Webmaker
    Participant

    @weblogian

    Can I display ads like adsense?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to display custom profile field?’ is closed to new replies.
Skip to toolbar