-
Author
-
February 21, 2017 at 23:33 #153773mitchcanParticipant
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.
February 23, 2017 at 13:33 #153965RaduModeratorHi,
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 solutionFebruary 24, 2017 at 00:53 #154074mitchcanParticipantYeah, 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.
February 24, 2017 at 17:33 #154105RaduModeratorHi,
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
RHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionFebruary 24, 2017 at 18:19 #154117mitchcanParticipantI thought I tried the xprofile ids, but I was more interested in making it work with ids
first_name
last_namewhich 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.
February 24, 2017 at 18:29 #154120RaduModeratorHi,
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 solutionFebruary 24, 2017 at 19:39 #154132mitchcanParticipantOK, 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.
February 25, 2017 at 00:58 #154146mitchcanParticipantThis 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.
February 27, 2017 at 17:08 #154264RaduModeratorHi,
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 -
AuthorPosts
The forum ‘Bugs & Issues’ is closed to new topics and replies.