Hello!
Has anyone been able to display the user last name in the profile page? I mean, there’s a default xProfile field for the first name (which gets ‘first_name/display_name’ user registration field); but I can’t find a way to get ‘last_name’. I’ve read some threads on this, but still can’t find a way.
Appreciate any guidance.
Best
JavierHi Javier,
Here some example code to display the full name of user in the profile. But You can manipulate user name value using the user id. Let me know if it works for you or not.
function buddydev_modified_user_profile_name( $name ) { $user_id = bp_displayed_user_id(); // You can Manipulate $name value using this user id $name = bp_get_displayed_user_fullname(); return $name; } add_filter('bp_get_displayed_user_mentionname', 'buddydev_modified_user_profile_name');
Thank You
RaviHi Ravi,
I’m testing your code, but can’t see any change.
I guess my question is confusing, I’ll try to clarify: if you register an user (from wp-admin/wp-users.php) there are Username (stored in wp_users db table), First Name and Last Name (both stored in wp_usermeta). My guess is that BuddyPress “syncs” ‘First Name’ with an extended profile field called ‘Name’; but does nothing with ‘Last Name’.Thank you
JavierHi Javier,
Thank you for clarifying.Please give a try to this plugin
https://wordpress.org/plugins/bp-xprofile-wp-user-sync/
That will do it for you.
Hope that helps.
Hello,
Finally I could not sync last name with users registered before “BP XProfile WordPress User Sync”: you have to update user’s data in order to make plugin work.
So my advice here is to install the plugin before adding users (especially if you are going to add a fairly amount, which was my case).Hi Javier,
Thank you for the update. Yes, you are right about it. Though it is possible to write a script that does it for the older registrations, It does not seem to be readily available.Marking the thread as resolved. Please do post a topic if you need any help in future 🙂
You must be logged in to reply to this topic.