Skip to:
Content
Pages
Categories
Search
Top
Bottom

Identifying profile fields by field ID


  • rgrober
    Participant

    @rgrober

    I’m adding profile fields to the profile header using this function:

    add_action( ‘bp_before_member_header_meta’, ‘display_user_phone’);
    function display_user_phone() {
    // echo ‘I choose this color: ‘;
    $args = array(
    ‘field’ => ‘AD Roles’,// Field name or ID.
    );

    $args2 = array(
    ‘field’ => ’16’,// Field name or ID.
    );

    echo ‘<h5>’;
    echo bp_member_profile_data( $args );
    echo ‘</h5>’;
    echo ‘<h5>’;
    echo bp_member_profile_data( $args2 );
    echo ‘</h5>’;
    }

    However, when I attempt to use the field ID, it doesn’t display the profile information. Using the Field Name works perfectly. I need to access the ID b/c some of the Field Names are long and involve punctuation.

    How do I enter the field ID to make this work?

    Thank you!

Viewing 1 replies (of 1 total)

  • djsteveb
    Participant

    @djsteveb

    I am interested in finding out what you come up with in regards to this.

    I tried to use something like:

    ‘field’ => 2,
    );

    (some info from https://codex.buddypress.org/themes/guides/displaying-extended-profile-fields-on-member-profiles/ )
    to replace the actual names I was using in a page title template thing, and never got it to work – but I have no idea what I am doing – trying to franken-hack a bit of code provided by one person and replace the field names with field numbers so the code would work with a different site I was playing with – when I tried replacing the name with this field number thing it did not work – but again I don’t understand php nor bp stuff well enough to know if I just missed a character, or something else was needed, or the function isn’t working as it should.

Viewing 1 replies (of 1 total)
  • The topic ‘Identifying profile fields by field ID’ is closed to new replies.
Skip to toolbar