How to use full name, first name + last name
-
At the moment Buddypress/WP MU makes it very hard, perhaps impossible, to flexibly use member’s real names or other data (companyname, city) in the site or have something like ‘Hello John’ in email notifications.
As default the full name is stored in one field, instead of as seperate first name and last name. This also kinda encourages new members to just fill out their first name or some BS pseudonym – I know this from my current home-baked site.
I have no clue how to retrieve the full name from the database. It’s not in the regular wp_users table, but in two other related tables. I guess this requires serious PHP/MySQL coding and I can’t find any clear examples anywhere.
Default Buddypress is fine for teens/tweens who want to use their anonymous username, but it’s not suitable for a more grown-up business network, for example.
I’ve found this excellent plugin that allows members to login with just their email address and password. It doesn’t automatically make the required changes to the notification emails etc. though.
Are there plugins that can fix these issues?
Are there custom sql/php code examples how to retrieve and use basic member info?
Are there tags or pieces of code that I can use site-wide for common things like the logged-in member’s real name?
-
If during registration the user actually enters their fullname–which means that there is at least a single space between their first name and whatever comes after that–then this function will parse the datum and create first_name and last_name meta pair entries in wp_usermeta.
Making that required would solve a lot of problems and make the system a lot more consistent imho. As it is you can’t rely on wp_usermeta (or fullname…), so if you want real names you have to come up with complicated work-arounds.
The full name registration field is already required. Why not put some standards on it? At the moment it is unclear, to users as well, what this field is for exactly. Display name? Another username? A blog name? A blog URL name?
The function will parse it as follows, placing these entries in wp_usermeta:
first_name: John
last_name: James Jacoby
Nothing wrong with that. It’s handy to be able to use the first_name separately, but I can’t think of scenarios where I would only use the last_name.
Even if you wanted to use last_name by itself, you have to work with the information the user gives you. If the user wants to be a pompous ass and include his middle name, that’s his problem.
First name + last name is an issue for me because I have to import a members list where this data is separate. So I need to make a decision what to do with that.
You could do a check to make sure that there is at least one single space in the “Full Name” field before allowing the registration to be processed, but you will have no guarantees that they have used their real full name or that they have used just their first and last names.
Facebook and LinkedIn don’t have those guarantees either. From my existing 600+ members list, built with a PunBB-based registration form, I know that most people will give their full, real names if asked nicely – I did need to add some code to capitalize the first letters.
It depends on the etiquette of the site. If everybody is identified with their full names, new members will give their full names to be part of the club. That’s one reason why I dislike usernames. Emphasizing usernames teaches users wrong behavior, says it’s OK to identify yourself by BS pseudonyms.
I had this test version of a reordered registration form. It works.
But leaving the one fullname field as it is and splitting separate firstname and lastname to wp_usermeta using xprofile_sync_wp_profile() is probably the better solution – thanks Jeff Sayre and Nicola Greco.
How would that work? Has anyone done it? Can anyone point me to code examples?
I’ll try to figure this out myself, but don’t know where to start. Codex and bp-dev.org provide very little information. I don’t know where else to look.
Why is this not built-in to Buddypress registration by default? It would make the system much more consistent, in particular with an added check to make a two (or more)-part name in fullname required.
Apparently lack of consistency/synchronization between members data in WPMU and members data in Buddypress x-profile causes other problems as well.
Please look into this! I was going to rely on WPMU/Buddypress for member management in my project, but am not so sure anymore.
The cleanest way to get separate firstname and lastname into the database seems to be to
1. split the input from Buddypress’ fullname field using xprofile_sync_wp_profile()
2. make a two or more part name in fullname required
How would I do that? Can someone please help, because this would solve a major structural problem in Buddypress imho.
I need to come up with a solution, because integration with most mailing lists depends on having firstname and lastname stored somewhere.
Alternatively I have to use fullname for firstname and create a second custom xprofile field for lastname. That solution will problably cause lots of problems further down the line.
- The topic ‘How to use full name, first name + last name’ is closed to new replies.