Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to add xprofile fields in the members directory


  • nkolaka
    Participant

    @nkolaka

    Hi everyone

    This code below add Age after the username in the members directory.

    /**
    * Show Xprofile Field Data After The username in The Members Directory.
    */
    function yzc_add_xprofile_field_data_after_username( $name ) {

    if ( bp_is_members_directory() ) {

    $field_data = xprofile_get_field_data( ‘Age’, bp_get_member_user_id() );

    return $name . ‘, <span class=”bp-user-age”>’ . $field_data. ‘</span>’;
    }

    return $name;

    }

    add_filter( ‘bp_member_name’, ‘yzc_add_xprofile_field_data_after_username’, 10 );

    Please I also want to include City and Country to this code. Can anyone help me modify this code to also include City and Country?

Viewing 1 replies (of 1 total)

  • thinlizzie
    Participant

    @thinlizzie

    Do you want it all as one big clickable link?
    So it displays like this, over three lines…. ???

    Name, Age
    City
    Country

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar