BuddyDev

Search

Replies

  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18200

    I am using Generatepress with a child theme. The Buddypress was not present, so I created this folder path:
    Generatepress_child >buddypress>members>members-loop.php where I copied the members loop.php, and left the original in place

  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18198
    This reply has been marked as private.
  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18196
    This reply has been marked as private.
  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18195
    This reply has been marked as private.
  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18193
    This reply has been marked as private.
  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18191

    No, sorry, I put the code before the closing tag, but no values. I am not a Jedi master in PHP, so It could be my lack of skills…
    Are backtick’s around ID or name not necessary?

  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18187

    Is this the right place to insert the snippet?
    Sorry it does not show anything in the fields, so a snippet for bp-custom.php would be much appreciated, thanks.

    <?php
    /***
    * 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’ );
    */
    ?>
    <?php echo xprofile_get_field_data( ‘578’, bp_get_member_user_id() );?>
    </div>

    Regards
    Carsten

  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18179

    Hi Brajesh, I found the members-loop under the template pack and copied it to my child theme. So far so good.
    I inserted the code here inside members loop copied the field ID 578 to the ‘Date Field Name’ as described (wp-admin/users.php?page=bp-profile-setup&mode=edit_field&group_id=1&field_id=578)

    But still no luck. Obviously this is not the right place to place the code?

    `/**
    * Fires inside the display of a directory member item.
    *
    * @since 1.1.0
    */
    do_action( ‘bp_directory_members_item’ ); ?>

    <?php
    /***
    * 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’ );
    */

    <?php echo xprofile_get_field_data( ‘578’, bp_get_member_user_id() );?>

    ?>
    </div>

    <div class=”action”>

    <?php`

    Regards
    Carsten

  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18162

    Hi again, I am sorry, but I can’t get it to work.

    I inserted the snippet in bp-custom.php, changed ‘Date Field Name’ with ‘age’ according to the profile field, but it does not show the value.

    ‘For efficiency, you can replace the field name with id too.’
    Please explain what you mean by this?

    Regards
    Carsten

  • Participant
    Level: Yogi
    Posts: 1112
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18119

    Thanks again, Brajesh