Skip to:
Content
Pages
Categories
Search
Top
Bottom

Add profile group fields in member page


  • Chirag Modi
    Participant

    @chiraggmodi

    hi
    i have make a community website.
    i want to display all fields which were added in the Profile Group Fields to member page.

    Currently i am using this code for member fields, but this code will get data randomly.
    Like… i have created group fields of Chief(main filed), SON, DAUGHTER, MOTHER< FATHER, SISTER, BROTHER.

    so when i display middle name filed then it take from other group fields not from chief group.
    This is the code which i used in custom.php


    // Here is one way you could add xprofile fields name as well as the value to the members directory!
    // Just remember to replace "Field-Name" with the names of your fields in the 5 variables in my code.
    // Also remember the field name is case sensitive. If you notice the pattern of 5 in my code you can
    // easily see how to add more fields if you need them. You can also use the div class bph_xprofile_fields
    // to adjust the CSS in your stylesheet. Place this code in bp-custom.php:
    add_action('bp_directory_members_item', 'bphelp_dpioml');
    function bphelp_dpioml(){
    $bphelp_my_profile_field_1='Field-Name';
    $bphelp_my_profile_field_2='Field-Name';
    $bphelp_my_profile_field_3='Field-Name';
    $bphelp_my_profile_field_4='Field-Name';
    $bphelp_my_profile_field_5='Field-Name';
    if( is_user_logged_in() && bp_is_members_component() ) { ?>
    <div class="bph_xprofile_fields" style=" margin-left: 25%;">
    <?php echo $bphelp_my_profile_field_1 ?>: <?php echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_1 ); ?><br />
    <?php echo $bphelp_my_profile_field_2 ?>: <?php echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_2 ); ?><br />
    <?php echo $bphelp_my_profile_field_3 ?>: <?php echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_3 ); ?><br />
    <?php echo $bphelp_my_profile_field_4 ?>: <?php echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_4 ); ?><br />
    <?php echo $bphelp_my_profile_field_5 ?>: <?php echo bp_member_profile_data( 'field='.$bphelp_my_profile_field_5 ); ?><br />
    </div><?php
    }
    }

  • The topic ‘Add profile group fields in member page’ is closed to new replies.
Skip to toolbar