Thanks for the suggestions. Alex, I can certainly see the profile data in that event, which is a step in the right direction. However, trying to save the real name into the CommonName doesn't have much effect. Can you spot an issue with this:
private void csa_PostUserProfileDataUpdate(UserProfileDataBase p, CSEventArgs e)
{
if (e.State == CommunityServer.Components.ObjectState.Update)
{
User user = CommunityServer.Users.GetUser(p.UserID);
string name = string.Concat(p.GetStringValue("FirstName", ""), " ", p.GetStringValue("LastName", "")).Trim();
if (!string.IsNullOrEmpty(name) && !user.Profile.CommonName.Equals(name, StringComparison.OrdinalIgnoreCase))
{
user.Profile.CommonName = name;
if (!Globals.IsNullorEmpty(user.Profile.CommonName) && user.Profile.CommonName.Length > 50)
{
user.Profile.CommonName = user.Profile.CommonName.Substring(0, 50);
}
user.Profile.CommonName = Globals.EnsureHtmlEncoded(user.Profile.CommonName);
user.Profile.Save();
}
}
}
Also, we really only want to set this on registration and allow the user to override the common name later on if they choose. The ObjectState - in debugging - is never Create. Is there some other piece of the puzzle I may be missing?
Thanks!