BuddyDev

Search

Replies

  • Participant
    Level: Yogi
    Posts: 1105
    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: 1105
    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: 1105
    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: 1105
    calu on in reply to: Code Snippet 'Add Xprofile fields to the member code' #18119

    Thanks again, Brajesh

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

    Hi Brajesh, thanks for the code. I always find it difficult to locate Members Loop in the directory, could you please guide me, to which folder it is in?

    Regards
    Carsten

  • Participant
    Level: Yogi
    Posts: 1105
    calu on in reply to: Suggestion for a new BP Registration plugin #18047

    I have done some research, and apparently it is not possible to combine WP Username and BP Profile name in one workflow, even though you would expect an auto fill of the BP profile name with the WP Username was an option.

    Another issue in the WP account registration is the lack of support of special characters in usernames like, æøå. Users expect to enter their real name here, so if your name is ‘Søren’ you can’t register! And why does WP not support capital letters, when all names starts with a capital letter…
    Fixing this with code involves a compromise safety I am told.

    The second best option is then to place the two name registrations next to each other, and make users repeat their Username (not knowing it is actual the BP Profile name they are filling out, or vise versa) The benefit is that users can accept choosing a profile name which is not with capital letters and containing æøå, rather than spelling their names wrong, e.g. ‘Søren’ has to be ‘soren’

    As it is, the Username is on top of the registration page and the Profilename sits in the bottom.

    How do I put BP name on top of the WP Account details?

    Regards
    Carsten

  • Participant
    Level: Yogi
    Posts: 1105
    calu on in reply to: Suggestion for a new BP Registration plugin #18038

    The unlogic thing about the registration/login process, from a users point of view, is that you do not use your BP profile name for login, which you would expect, but your WP Username. On the other hand, it’s your BP Profile name which appears on your profile…

    These two names could in principle be the same, so there must be a way of feeding the information from the BP Profile name field to the WP account registration

  • Participant
    Level: Yogi
    Posts: 1105

    I just tested the code, and it is working without BP Force Profile Photo activated, great!

  • Participant
    Level: Yogi
    Posts: 1105

    Hi there, found the code, thanks!

    Is the code dependent of the BP Force Profile Photo to be activated?

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

    Hi Brajesh, it is the code from BuddyDevs own Code Snippet directory by bphelp:

    Add Xprofile fields to the members directory
    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
    }
    }