DotNetNuke ‘Un-Register’ Hack

So you are using DotNetNuke but you don’t want the users to be able to ‘un-register’ themselves, but you still want the administrator to be able to delete a user. You can use this un-register hack to accomplish this.

This is a modification to the core DotNetNuke code and I assume no responsibility for any damages that this hack may cause. Attempt this change at your own risk. Also you may want to document this change because each time you upgrade DotNetNuke the change will need to be made or it will be lost. It should also be noted that modifications to the core code of DotNetNuke is not recommended.

This is really a simple change to the code in fact you can make the change in any text editor. I am going to make a couple of assumptions here. First that you have the version of DotNetNuke that you will be installing on your server on your development machine. Second you are a little familiar with where DotNetNuke keeps things.

Ok here we go. You will need to find the file named ‘User.aspx.vb’. You can find this file in the following path: ‘..DesktopModulesAdminSecurityUser.aspx.vb’. Be careful because there is another file named ‘Users.aspx.vb’ this is the incorrect file.

Open the file with your choice of text editor. You will want to find the method titled ‘DataBind()’.

In this method you need to find the following code:

I’ve highlighted in blue the code that needs to be added. The reason this works is that everyone is a user so really the if statement is always true. By adding in the Not and IsAdmin this makes this only true for registered users and not for the admin or host accounts. Then using the cmdDelete.Visible  = False statement this allows the control to load like normal, but it will not show up on the page. This avoids breaking anything else in DotNetNuke code.

This is the change that worked for me.