Firstname and Lastname fields on registration page

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
10/16/2012 6:46:08 AM
Gravatar
Total Posts 60

Firstname and Lastname fields on registration page

Apologies if I'm being dense, but there's something that doesn't work right for us with user registration and I suspect many others will be in the same boat.

  • With almost all our sites, users register using email address rather than userid, so we would prefer to hide the userid field when they register.
  • We also always need to record their firstname and lastname and the display name should be a concatenation of these.  
    (We currently record them in the userprofile data but it's not easy to generate the displayname from them and it seems silly as they're such core items and there are already fields in the users table.)
  • Although MojoPortal has firstname and lastname fields in the mp_users table these never seem to be used and I can't see any way to switch them on (there's no reference to them in Register.aspx).
  • If we use <add key="AutoGenerateAndHideUserNamesWhenUsingEmailForLogin" value="true"/> the username and displayname are derived from the email address.  Although this is fine for the username it's almost always wrong for the displayname.

So...would it be possible to have another two config switches called, say "ShowFirstandLastnameFieldsInRegistration" and "DeriveDisplayNameFromFirstAndLastName"?  When used in combination with "AutoGenerateAndHideUsernames..." this would allow us to hide the username field, show firstname and last name and derive the Displayname.

Thanks

Ian

10/16/2012 9:57:23 AM
Gravatar
Total Posts 18439

Re: Firstname and Lastname fields on registration page

Hi Ian,

Display name has been included since the begining of mojoPortal, firt and last name were added much later and cannot be sure that they are populated for existing users though it can easily be added to the registration page and required for registration. In fact in recent versions it was changed in mojoProfile.config to be shown by default on the registration though it is not configured as required by default.

However, you can easily make it required in your site by copying  and renaming the mojoProfile.config and configuring your site to use your custom version of it, then you can mark those properties as required for registration.

We cannot treat the first name and last name the same as display name. In many scenarios users may be willing to provide their real name but not want it shown to the public in the member list or other places. The display name allows them to show something else like a nick name.

However, I recognize that there are also scenarios where it would be desireable to show the real first and last name and it is currently possible, I've just created the article Member List Display Settings which should help you with that.

In the latest version the welcome message can also be configured from layout.master to show the first and last name if it is populated.

<portal:WelcomeMessage ID="WelcomeMessage" runat="server" UseFirstLast="true" RenderAsListItem="true" ListItemCss="firstnav" />

Hope that helps,

Joe

10/27/2012 7:15:58 PM
Gravatar
Total Posts 60

Re: Firstname and Lastname fields on registration page

Hi Joe,

Thanks for your speedy replay and apologies for my delayed one - I had to do an upgrade to 2.3.9.3 first so that I could test properly.

I am already using a customProfile.config to add firstname and lastname, but doesn't this cause the names to be stored in the mp_UserProperties table rather than the firstname and lastname columns in the mp_Users table?  I'm keen to get the data into the mp_Users firstname and lastname columns so I can then use triggers (or whatever) to do the rest.

Thanks, and apologies if I'm missing something obvious.

Ian

 

10/28/2012 10:11:09 AM
Gravatar
Total Posts 18439

Re: Firstname and Lastname fields on registration page

FirstName and LastName are special cases that do exist in mp_Users and are explicitely mapped to those fields from code whereas any arbitrary properties you add will be stored in mp_UserProperties

Those properties are case sensitive. To map to the FirstName and LastName fields in mp_Users they must be FirstName and LastName not firstname and lastname.

Hope that helps,

Joe

10/29/2012 7:02:35 AM
Gravatar
Total Posts 60

Re: Firstname and Lastname fields on registration page

Arrgh!  Suspected it was something straightforward!

Thanks Joe - it might be worth mentioning the case sensitivity in your new piece of documentation (or making it non-case-sensitive) since mine had mutated to Firstname and Lastname.

Thanks again

Ian

10/29/2012 11:47:57 AM
Gravatar
Total Posts 60

Re: Firstname and Lastname fields on registration page

OK, so for anyone in the same boat as me here's a horrid work-around trigger which will update the displayname to  "firstname lastname" when a user registers or is added by an admin.  If no firstname or lastname are entered if will fall-back to the system generated displayname.

Wasn't quite as straightforward as I'd hoped since the displayname is set in an update  rather than the original insert.  I had to add a 5 second timer to catch the system's initial update of the user's details without over-writing any deliberate updating of the display name that the user might do.

 

So all pretty yucky but it does work...

ALTER TRIGGER [dbo].[mp_Users_AddDisplayName]
ON [dbo].[mp_Users]
AFTER update
AS
BEGIN
   update mp_Users set name= i.firstname + ' ' + i.lastname
   from inserted i inner join mp_Users u on i.userid=u.userid
   where
     ( (i.firstname is not null and i.firstname <>'')
   or
      (i.lastname is not null and i.lastname <>''))
   and u.datecreated>getdate()- 0.0000579)
END

10/29/2012 1:24:07 PM
Gravatar
Total Posts 18439

Re: Firstname and Lastname fields on registration page

I've updated the documentation to mention that it is case sensitive. I don't think trying to make it not case sensitive would be a good idea.

Thanks for the beers! Very appreciated.

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.