revolution icon indicating copy to clipboard operation
revolution copied to clipboard

User Profile: Firstname & lastname field instead of fullname

Open modxbot opened this issue 12 years ago • 20 comments

markh created Redmine issue ID 7695

Some applications reusing the existing security system require a separate first and last name, which, while possible by using extended fields or custom fields, is not as intuitive as it should be.

I'd like to propose replacing the User Profile's fullname field with two separate fields for first and last name, and for backwards compatibility creating a fullname alias to firstname + lastname (or even better, a configurable way of concatenating first and lastname, such as "lastname, firstname"). This would allow more flexibility compared to what is offered now and make it easier to integrate with custom systems that expect them separately.

With something like this we may need to consider the middle thingy in a name (don't think it's common in the US, but it is down here):

firstname +(de|van (den|der)?|ten)+ lastname

No idea what the English term for that is. It's tussenvoegsel in Dutchy.

modxbot avatar May 02 '12 21:05 modxbot

christianseel submitted:

I would like to push this for the upcoming MODX 2.3.0!

Also Discuss is splitting the fullname currently very ugly... So MODX 2.3 can do this too!

Jay came up with the idea to continue using the fullname field (as backup for existing projects) and only adding firstname and lastname. During the update the fullname could be splitted with a nice function that we could work on together.

I think it's a shame that MODX "Revolution" has only a fullname field - let's change this!

christianseel avatar Aug 20 '13 14:08 christianseel

boomerang submitted:

I'd like to see this added as it would make linking with other products eg MailChimp or Foxycart so much easier. Otherwise its extending the moduser which isn't for everyone.

boomerang avatar Nov 06 '13 22:11 boomerang

:+1:

pixelchutes avatar Feb 22 '14 15:02 pixelchutes

As @christianseel mentioned, I did propose to have a First, Last and keep Fullname for legacy installations and on upgrades, we could do a best guess split or it could be a post-upgrade process. At modx.com we currently use a processor to guess the first name and last names, but as I am sure you realize it's limited. Here's an example of how we're using in hook for mailchimp:

// Get the Names
$fullname = $hook->getValue($field_fullname);

list( $fname, $mname, $lname ) = explode( ' ', $fullname, 3 );
if ( is_null($lname) ) {
    //Meaning only two names were entered...
    $lastname = $mname;
} else {
    $lname = explode( ' ', $lname );
    $size = sizeof($lname);
    $lastname = $lname[$size-1];
}
$my_email = $hook->getValue($field_email);
$merge_vars = array('FNAME'=>$fname, 'LNAME'=>$lastname);
$modx->setPlaceholders(array(
    'contact_first' => $fname,
    'contact_last' => $lastname,
),'ch.');

jaygilmore avatar Feb 22 '14 17:02 jaygilmore

Agreed, we should have First, Middle, Last with the current fullname being populated with the concat'ed versions of the new fields IMO.

garryn avatar Jun 06 '14 20:06 garryn

Really? Middle too?

OptimusCrime avatar Jun 07 '14 19:06 OptimusCrime

I concur, not sure middle is needed. Suggest simplicity is golden.

On 7 Jun 2014, at 20:23, OptimusCrime [email protected] wrote:

Really? Middle too?

— Reply to this email directly or view it on GitHub https://github.com/modxcms/revolution/issues/7695#issuecomment-45418842.

StevenMorgan avatar Jun 07 '14 19:06 StevenMorgan

We should add fields for the first- and last name but also keep one for the fullname. This makes it possible to use an alternative full name. First name: John, last name: Doe and full name J. Doe

JoshuaLuckers avatar Mar 09 '19 16:03 JoshuaLuckers

To split or not to split?

If designing a form or database that will accept names from people with a variety of backgrounds, you should ask yourself whether you really need to have separate fields for given name and family name .

This will depend on what you need to do with the data, but obviously it will be simpler, where it is possible, to just use the full name as the user provides it.

@Mark-H shared links with more information about this complex topic: https://github.com/modxcms/revolution/pull/14803#issuecomment-558621063).

After doing more research I don't think adding a first- and last name field to the core is a good idea.

JoshuaLuckers avatar Feb 23 '20 15:02 JoshuaLuckers

Really, why was this closed? Having first and last name fields is such basic data. Without it, there is no way to sort by last name reliably, as Jay commented 8 years ago. I was just going to add a request to add this. What is the issue with adding this to the core? The extra "ExtraFields" was recently released that makes adding fields to the table possible, but I'd rather not have to depend on that.

SnowCreative avatar Jun 09 '22 17:06 SnowCreative

@SnowCreative did you read my last comment and the links with more information about this? Having a first- and last name field seems as something basic, but it actually isn't: https://www.w3.org/International/questions/qa-personal-names

Therefore I decided it's best if we keep the most simple form that works in all cases, a full name.

JoshuaLuckers avatar Jun 10 '22 07:06 JoshuaLuckers

Yes, names can be complicated. But I didn't see anything in that article that would argue against having multiple name fields, whatever you decide to call them. And if you take the article "Falsehoods Programmers Believe About Names" as your guide, you would have to set up more than one name field because some people use more than one full name!

You seem to be making this an either/or situation, which I don't think it is. I would argue that fullname does NOT "work" in all cases, because at least for Western names, you can't sort in the desired way by fullname. Why not have fullname and ALSO first/last (or whatever) names? This setup would truly "work" in all cases. I understand that you don't want to REPLACE fullname with the two name fields, as was the idea in the original request.

I would also bet that the vast majority of MODX users use first/last or given/family or given/patronymic or name1/name2 names. If particular users don't want to use these two fields, then they can ignore them and just use fullname, or use them and call them something else. My main complaint is that, for the vast majority of MODX users who want to use two names and potentially sort by them, there is no way to enable this in the core.

For comparison:

  • Wordpress has first and last name fields for users, as well as a nickname.
  • Drupal's core Profile module lets you enable first and last name fields, and there is a Name Field module that lets you set up title, given name, middle name, family name, generational suffix, and credentials.
  • Concrete has an option to enable the user attributes first_name and last_name.
  • ProcessWire has first and last names for users.
  • Hubspot has first and last name fields for users (as I'll bet just about all customer relation managers do). As boomerang noted above, having two names would make linking from MODX to external products easier.

I'm sure many other CMSs have two name fields for users, in addition to a full name or nickname. People coming to MODX from these other systems may wonder why they can't enter two names. I've seen lots of posts in various discussion boards asking this very question — how to enter first and last names in CMSs that don't have this built in.

SnowCreative avatar Jun 10 '22 14:06 SnowCreative

I agree with Michael on this one; I've always disliked that full name is the only option.

smg6511 avatar Jun 10 '22 16:06 smg6511

There are other cultures where a first and last name may not be adequate.

https://culturalatlas.sbs.com.au/mexican-culture/mexican-culture-naming

rthrash avatar Jun 10 '22 16:06 rthrash

There are other cultures where a first and last name may not be adequate.

Anyone creating a site for Mexico could use just the fullname field. Or they can use all three name fields for whatever they want (fullname + nickname, or personal name + father's name + mother's name, or whatever). And if a site truly has a more unusual need for the name fields, the extra "ExtraFields" can be used to set that up (thanks, Aleksandr! Boshnik).

SnowCreative avatar Jun 10 '22 16:06 SnowCreative

I would say, usually just for user management, and that is what the build-in tables are for, a fullname should be enough to identify a user by name. If you need more, than just a user management, in most cases you will need more additional fields than just a first and lastname and you will create custom tables anyway, IMO.

Bruno17 avatar Jun 12 '22 11:06 Bruno17

I would say, usually just for user management, and that is what the build-in tables are for, a fullname should be enough to identify a user by name. If you need more, than just a user management, in most cases you will need more additional fields than just a first and lastname and you will create custom tables anyway, IMO.

The main User table just has username and password, but the built-in Profile table (user attributes) already has much more — email, phone, mobile phone, address, country, zip, fax, photo, website. Everything you'd expect in a basic customer management system, except the name fields.

SnowCreative avatar Jun 12 '22 13:06 SnowCreative

The main User table just has username and password, but the built-in Profile table (user attributes) already has much more — email, phone, mobile phone, address, country, zip, fax, photo, website. Everything you'd expect in a basic customer management system, except the name fields.

That allready are to much unused fields, in most cases. I would prefer to have the essential fields like email and maybe a fullname within the user table and have a way, like TVs for resources, where we could add as many fields as needed for specific use-cases or a built-in way to create custom - tables with custom fields(something like MIGXdb), which could be connected in a simple way to the user table and added to the user-management.

Bruno17 avatar Jun 12 '22 14:06 Bruno17

I always create custom tables for customer management systems. That frees me up to do whatever I want. But I'm talking about something much simpler here. When I view a list of MODX users, I can sort by username, I can sort by email address, but I can't sort by last name, which is a very common need for Western website users.

There are also numerous extras that use MODX's built-in user system — extras that need to record certain basic info. They don't create any custom tables. And they can't enter fields you see on the great majority of signup forms out there: first and last name.

SnowCreative avatar Jun 12 '22 14:06 SnowCreative

Can we turn this into a detailed proposal that would, from a core point of view, be useful around the world? Including how to deal with upgrades, what should be required or optional, what the recommended course of action for extras interacting with it would be, etc?

Mark-H avatar Jun 12 '22 14:06 Mark-H