Custom registration web part with full name field does not save the full name correctly

   —   
This article describes how to avoid incorrect saving of full name in Custom registration web part. If you use a Full name field in Alternative form this web part saves an incorrect value.
Please find the file:

~\CMSWebParts\Membership\CustomRegistrationForm.ascx.cs

This code is causing the issue:

// Fill optionally full user name
string fullName = "";
if (ui.FirstName.Trim() != "")
{
fullName += ui.FirstName;
}

if (ui.MiddleName.Trim() != "")
{
fullName += " " + ui.MiddleName;
}

if (ui.LastName.Trim() != "")
{
fullName += " " + ui.LastName;
}
ui.FullName = fullName;



It should look like:

// Fill optionally full user name
if (String.IsNullOrEmpty(ui.FullName))
{
string fullName = "";
if (ui.FirstName.Trim() != "")
{
fullName += ui.FirstName;
}
if (ui.MiddleName.Trim() != "")
{
fullName += " " + ui.MiddleName;
}
if (ui.LastName.Trim() != "")
{
fullName += " " + ui.LastName;
}
ui.FullName = fullName;
}


This bug is fixed in the 4.1 version.



See also:

Applies to: Kentico CMS 4.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.