Oct
19
2014
Since DotNetNuke 6, it is possible to require unique display names. This allows social modules to display a name for a user without exposing the login UserName or the real person first and last names. If you site uses social features, it is important that those display names be unique to prevent a user to post content in the name of another user.
By activating this feature, users are no longer able to register with a Display Name already in use. However, there are 2 oversights. First, the user or an admin can change the Display Name after registration to anything else (including a Display Name already in use). Secondly, you may already have duplicates before you activate this feature, and they don't get automatically changed. In this blog post, I provide you with both solutions the these problems.
Prerequisites
BACKUP YOUR WEBSITE FILES AND DATABASE!
This procedure has only been tested on DotNetNuke 7.3.3, so I recommend you first upgrade to this version. If you feel like trying it out on other versions, feel free to do it and post your results in the comments, but make sure you do that backup first.
1. Activating the feature
First, we will activate the feature requiring unique display names.
- Connect to your website as an administrator
- Navigate to Admin -> Site Settings
- Click the User Account Settings tab
- In the Registration Settings section, tick Require Unique Display Name
- Click the Update button at the bottom
Now, it will be impossible for user to register using a Display Name already used by another user.
2. Correcting the problem
I created a patch or DotNetNuke 7.3.3 that will prevent users and admins to change the Display Name to something already in use. Like I said before, this is for DotNetNuke 7.3.3, feel free to test and comment on other versions, but make sure you have backup. I submitted a the bog repport DNN-5874 and patch (pull request 160 now pull request 177) to DotNetNuke and I hope it will be applied to DotNetNuke 7.3.4. I will update this blog post when it is done. Update 10/21/2014: DotNetNuke has merged the pull request which means it should be part of 7.3.4. 2014-10-24: They have refused pull request 160 and I submited a new pull reques, I am still not sure if it will be merged to 7.3.4 or 7.4.0.
- Upgrade DotNetNuke to version 7.3.3 (or try with another version and report in the comments)
- Download the file PatchDNN-5874.zip
- Extract that file to your root DotNetNuke folder overwriting the files
- (optional, if you site has other languges):
- Go to Admin -> Languages
- Translate those keys:
File |
Key |
DesktopModules/Admin/Security/App_LocalResources/EditUser.ascx.resx |
DisplayNameNotUnique.Text
|
DesktopModules/Admin/Security/App_LocalResources/User.ascx.resx
|
DisplayNameNotUnique.Text |
We have now resolved this issue allowing users to change their display name to another one in use.
3. Fixing existing duplicates
Now that the issue is resolved for the future, we need to resolve it for the past. Your site may already have duplicate display names before this patch. In order to solve that, I have created a small module that will display all duplicates and allow you to change them in batch by clicking a single button, it will append the UserID to the display name to all users except the first that registered with that display name.
- Download the file DuplicateDisplayNamesFix_00.00.01_Install.zip
The source package is also available if you are a developer DuplicateDisplayNamesFix_00.00.01_Source.zip
- Install it like any other module (Host -> Extensions -> Install Extension Wizard
- Create a temporary page that is only visible by administrators (or use an existing admin page)
- Place the Duplicte Display Names Fix module on that page
- The module will display a list of all users with duplicate display names or a message if none are present
- You can export the list to Excel or CSV if you want to keep that information for your records (to send them an email for example)
- Now you can click the GO button to rename them.
(this operation cannot be undone, make sure you have that backup.)
- If you don't think to use the module again you can now uninstall it and delete the temporary page
All questions and comments are welcome.