Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display profile fields on members page


  • nowfoods123
    Participant

    @nowfoods123

    Hi,

    I’m new to wordpress/buddypress and I’m having trouble displaying field names.
    I have a field named “Age:” and using the following code:

    bp_member_profile_data( 'field=Age:' );

    in the members-loop file, the members age is displayed. I would like to add “Age: ” in front of the number, I searched and found this thread:

    https://buddypress.org/support/topic/displaying-profile-field-name-in-member-loop/

    but all the suggestions leave me with a blank members page???
    If I remove the opening and closing php tags for the bp_member_profile_data section and use

    <p>Age: <php bp_member_profile_data( 'field=Age:' );?><p>

    I get the following under all profiles despite only one having an age value set:

    /*** * If you want to show specific profile fields here you can, * but it’ll add an extra query for each member in the loop * (only one regardless of the number of fields you show): * * bp_member_profile_data( ‘field=the field name’ ); */

    Age:

    the one profile with an age value set isn’t shown.
    Can anyone see where I’m going wrong with this?

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

  • kmw1130
    Participant

    @kmw1130

    I was able to get a field to display, but it only displays on the Member’s profile page and I want it to display on the members page where all the members are shown. I’ve updated the members-header.php page, so maybe there is another page that needs to be updated.


    shanebp
    Moderator

    @shanebp

    You don’t need to touch the members-loop template file.
    Try putting this in your theme/functions.php or in plugins/bp-custom.php

    function add_age_to_members_loop() {
        $field_content = bp_get_member_profile_data( 'field=Age' );
        if( $field_content != false )
          echo "Age: " . $field_content;
    }
    add_action( 'bp_directory_members_item', 'add_age_to_members_loop' );

    skunkgrunt
    Participant

    @skunkgrunt

    Why in the world is it this difficult? This should be in buddypress core. Considering that buddypress is supposed to be a social network out of the box, and member profiles are such an integral part of any social network, very little thought has gone into the profiles page.

    Compare adding fields in buddypress to any other social network platform (elgg, oxwall, jcow, dolphin, etc.) and it’s just not there. Why should I have to dig into code just to add a profile field. There should be a drag and drop profile builder.

    Avatar location, cover photo, customizable sections and profile fields; they should all be drag and drop.

    I wish I was a coder. This is #1 on my priority list of buddypress improvements.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display profile fields on members page’ is closed to new replies.
Skip to toolbar