This topic has 8 replies, 2 voices, and was last updated 7 years by Radu.

  • Author
  • #153773
     mitchcan
    Participant

    Hey,

    I’m struggling with a kleo template. In kleo/buddypress/members/members-loop.php it seems as though line 63 is requesting bp_member_name which is supposed to be the Display Name, but in some users, it seems to be grabbing the username instead. I can’t figure out why?

    In a perfect world, I want to make sure the page renders the user in a First Name Last Name format. I have tried many plugins and code snippets to accomplish this, to no avail.

    But in this case, the display name IS listed as FN LN in the admin view of the user profile, but that user is displaying the ‘username’ on the kleo /members page.

    Any ideas?

    Kleo 4.1.8

    BuddyPress 2.80

    Thanks.

    #153965
     Radu
    Moderator

    Hi,

    That users encounter the same issue using parent theme instead of the child?

    Did you have tried this plugin? https://wordpress.org/plugins/bp-display-name/

    It seems to be capable for what you need

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #154074
     mitchcan
    Participant

    Yeah, I’m not going to mess with a plugin that has less than 100 actives and hasn’t been updated in 5 years. 🙂

    I did revert all of the changes I had made in php back to default. So the proper ‘display’ names are now showing, but only for those that have manually changed the display format in settings. Otherwise the default seems to be username.

    I also tried the Force First Last Name plugin, but also did not work as I envisioned.

    Lastly, I recently tried the code I found that you posted here: kleo display code but that also failed to work.

    Can you tell why that members-loop code you did might not work? It seems like it would be perfect, but it did not pull that info.

    Thanks, have a good day.

    #154105
     Radu
    Moderator

    Hi,

    Maybe the ID’s are not the same

    You should specify the ID of the fields that contains the first name and the second name

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #154117
     mitchcan
    Participant

    I thought I tried the xprofile ids, but I was more interested in making it work with ids

    first_name
    last_name

    which do have data in them.

    <input type=”text” name=”first_name” id=”first_name” value=”cap” class=”regular-text”>
    <input type=”text” name=”last_name” id=”last_name” value=”jones” class=”regular-text”>

    Shouldn’t those work as well?

    If so, maybe I did something wrong here:

    $FirstName = first_name(”, bp_get_member_user_id());
    $LastName = last_name(”, bp_get_member_user_id());

    I’m a cut and paste coder, so I likely missed something. 🙂

    Thank you for your help.

    #154120
     Radu
    Moderator

    Hi,

    That solution works only with profile ids and you should add the ID of the field form wp-admin -> users -> profile fields ->

    From example, Name field has id 1 and the second name will have a different ID depends on by how and when you have created that field and that’s all

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #154132
     mitchcan
    Participant

    OK, so I got it to work with the xprofile fields, thank you.

    But the whole sync process between WP, Woo and BP is a complete cluster… – you’d think all being Automattic properties, they’d have their act together for playing nice. Ridiculous.

    What I want to show on the members-loop is the First Name and Last Name as is in WordPress, which came from my registration form. I tried to use the Force Display plugin, but it didn’t work. I didn’t really want to set up xprofile fields for First and Last in the Reg form, as it seemed so redundant for the user.

    I’m ranting, but it’s not at you. 🙂 I appreciate your help.

    By the way, is there an easy way to have a fallback, where if the xprofile fields in the code are empty, it then falls back to that bp_member_name() data?

    Thanks Radu.

    #154146
     mitchcan
    Participant

    This may be a dumb question, but is it just not possible to call WordPress fields like First_Name and Last_Name in the members-loop file? It just seems like it would be so simple.

    And I have looked for hours for a decent, working WP to BP xprofile field sync with no luck.

    Thanks again for your time.

    #154264
     Radu
    Moderator

    Hi,

    You can pull the info’s from the WordPress profile like first name and last name using this method: https://codex.wordpress.org/Function_Reference/get_currentuserinfo#Default_Usage

    You can use those also in members-loop.php file

    As an example

    $FirstName = xprofile_get_field_data(‘1′, bp_get_member_user_id());
    $LastName = xprofile_get_field_data(’41’, bp_get_member_user_id());

    if(empty($FirstName)){
    $FirstName = $current_user->user_firstname;
    }

    if(empty($LastName)){
    $LastName = $current_user->user_lastname;
    }

    For further development, I recommend hiring a developer since those are not theme problems and those are custom things.

    https://architectedfutures.info/2011/08/23/bp-wp-profile-sync/

    Have a nice day

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 9 posts - 1 through 9 (of 9 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?