Skip to:

Re: How to use full name, first name + last name

Jeff Sayre


So this synchronization only happens when users edit their profile after registration? Would it be possible to require the user to enter a more than one-word name in the fullname field and guarantee that synchronization with wp_usermeta always takes place on registration?

Okay, I made a slight mistake in describing this process. I should not do support after 10 pm.

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.

But, if they simply put everything together as a single word, then it will not have anything to parse–it needs a space and something following that space.

But this is imperfect as jjj has indicated above. Let’s use his name as it appears in as an example.

John registers for a BP-based site and enters this in the “Full Name” registration field:

John James Jacoby

The function will parse it as follows, placing these entries in wp_usermeta:

first_name: John
last_name: James Jacoby

So, the system does work to some extent but you will have to ask all registering users to make sure they enter just their first name and just their last name with a single space between. If they also include their middle name(s), then those will be assumed to be part of their last name.

Finally, if they choose to not follow the registration instructions, instead just merge their first, maybe middle, and last names together, then the function will not create the desired first_name and last_name wp_usermeta entries. Those entries will only be created if they latter edit their Full Name profile datum, adding a space between their names.

So, if jjj instead had entered:


There would be no entries in wp_usermeta from which you could extract his first and last names.

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.

Skip to toolbar