Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0User Registration - Removing DisplayName PropertyUser Registration - Removing DisplayName Property
Previous
 
Next
New Post
8/9/2007 8:14 AM
 

I think I have found the solution to all of my problems.  And for everyone else, this will probably be pretty good to know...  (FYI - this testing was done on DNN v4.05.03.)

In a test environment, I created users and then changed the User Settings to use "[USERNAME]" as a token to replace the "Display Name", inheritly hiding the "Display Name" fields.  Then, I ran the source through debug and noticed that the DisplayName property was indeed returning this value directly from the UserInfo object.  So, that led me to look more closely at the UserInfo class.  When I removed the token from User Settings, the "Display Name" fields were all returned to normal, but they still had the tokenize values.  This led me to initially believe that the database was updated to reflect the token change (but I later found that this is a cache issue).

When I checked out the actual DisplayName property in the source, there was nothing out of the ordinary.  The property was simply returning a private object value.  The constructor had nothing out of the ordinary going on either.  However, there was another method in the class that caught my attention:

Public Sub UpdateDisplayName(ByVal format As String)
 'Replace TOKENS
 format = format.Replace("[USERID]", Me.UserID.ToString())
 format = format.Replace("[FIRSTNAME]", Me.FirstName)
 format = format.Replace("[LASTNAME]", Me.LastName)
 format = format.Replace("[USERNAME]", Me.Username)
 DisplayName = format
End Sub

As you can see, there is a method that is not changing the value in the database, but just replacing the value using one of the other properties.  When I removed the User Setting token, the UserInfo object was still in cache.  In order to fully restore this, you would need to perform an action that releases the cached objects (IIS restart, web.config change, restart application, recycle app pool, etc.).

Also, be sure to note that although this is not widely documented, you are limited to the four tokens you see in the method above.

In order to solve my specific issue and to meet my project requirements, I am going to go into my custom membership provider and put the DisplayName property back the way I want it, while still allowing the DNN Core to remove the "Display Name" fields using the token in "User Settings".  Although I have not implementing this yet, I am sure that this will work!  :)

Happy DNNing!


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
8/9/2007 8:24 AM
 

Sorry...  I should add that adding [DISPLAYNAME] as a token might effectively allow all of us to have the best of both worlds.  Just a thought...

[EDIT]
Also, I just checked the source for v4.05.03 and it hasn't changed.
[/EDIT]


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
8/9/2007 1:52 PM
 

Here I am multiple-posting...  But in this case, it is worth it.  It appears that the DNN core code does nothing if you specify a token that it doesn't recognize.  (Duh!)  However, upon seeing that the token is specified, it replaces all DisplayNames in the database with the value specified with the token (only the four tokens that it recognizes). 

If you for some reason decide that you do not like to use the token, removing it will not return the Display Names to their original values.   I repeat...  DNN does not archive or otherwise save the previous DisplayNames.  If you remove the token, then DNN will use its default Display Name of [FIRSTNAME] [LASTNAME].  This is hard-coded in the DNN Membership Provider.

However, there is an easier fix to my specific problem than what I initially thought was necessary.  First, I used a token of [NOTHING] to make sure that the DisplayNames would not be overridden.  Next, I went into the code-behind of the ~/admin/Users/UserSettings.aspx file and commented out the following code (approximately Line 168):

If key = "Security_DisplayNameFormat" Then
    'Update the DisplayName of all Users in the portal
    Dim objUserController As New UserController
    objUserController.PortalId = UserPortalID
    objUserController.DisplayFormat = setting
    Dim objThread As New Thread(AddressOf objUserController.UpdateDisplayNames)
    objThread.Start()
End If

The snippet we commented out simply checks the key of the UserSettings property editor and if the key matches the string name, it assigns the PortalId and the provided token to the UserController class.  Then, the UpdateDisplayNames method is called, which updates the Display Name of every single user in the specified portal (this method requires the previous two properties in order to call a subsequent UpdateUser method).  Since a portal could potentially have thousands of users, this step is run on a separate thread, which allows the code to continue to run while this step completes.

The Bottom Line...

Commenting out the preceding code and setting the Display Name token to an unknown token ensures that your existing Display Names remain intact, and that all instances of the Display Name field are removed and/or readonly throughout the portal.  All new users will automatically be assigned the Display Name using their First Name, a space, and their Last Name.  That is, unless you have a custom Membership Provider that reassigns this property value.


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
New Post
3/15/2008 3:39 PM
 

Running 4.8.1

Is there a way to remove Display Name from the Registration Form (tokens or otherwise) without having to recompile?

 
New Post
4/5/2008 9:05 PM
 

As specified in earlier replies in this thread, simply add known tokens into the Display Name property of the User Settings.  This will automatically populate the Display Name, and in effect removing it from the registration form.  In the User Account module, it will be displayed as a label instead of a textbox.


Will Strohl

Upendo Ventures Upendo Ventures
DNN experts since 2003
Official provider of the Hotcakes Commerce Cloud and SLA support
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0User Registration - Removing DisplayName PropertyUser Registration - Removing DisplayName Property


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out