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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Help!!! CanHelp!!! Can't delete users
Previous
 
Next
New Post
2/17/2011 10:40 AM
 
I'm using DNN 4.9.5. I have two users I'm trying to delete and every time I try I get the following error message "Can't Delete User". I've search the forum looking for a SQL script or any other method of doing so. I haven't found anything that works or that I understand much of. I have a site that I've been testing and it's ready for launch. But I would like to rid the two test users before doing so. Any help would do.

Note: I've had other users that I could deleted OK. I'm not a DB expert so I'm VERY leery of l assessing the database directly.

Thanks
 
New Post
2/17/2011 3:32 PM
 
Are you trying to hard delete or soft delete the users? If it's a soft delete I'm pretty sure you cannot delete either the Admin or Host account. And you must have at least one Admin account per site from what I understand.

If you are looking for a hard delete (purging them from the database directly). Then the following script will remove them from the database. You must run it from inside your DNN installation and not the SQL server directly.

Hard Delete User Script

//Since DNN can only soft delete users you'll have to run the follow script to ensure that all user data is hard deleted from the database
//You must run the script from the HOST MENU through DNN and not from sQLserver directly
//The script will only delete one user at time, you will have to keep executing it until all users have been deleted

delete {databaseOwner}{objectQualifier}userroles where userid=(select top 1 userid from {databaseOwner}{objectQualifier}userportals where isdeleted=1 and userid not in (select userid from {databaseOwner}{objectQualifier}userportals where isdeleted=0))
delete {databaseOwner}{objectQualifier}userprofile where userid=(select top 1 userid from {databaseOwner}{objectQualifier}userportals where isdeleted=1 and userid not in (select userid from {databaseOwner}{objectQualifier}userportals where isdeleted=0))
delete aspnet_membership where userid=( select userid from aspnet_users where username=(select username from {databaseOwner}{objectQualifier}users where userid=(select top 1 userid from {databaseOwner}{objectQualifier}userportals where isdeleted=1 and userid not in (select userid from {databaseOwner}{objectQualifier}userportals where isdeleted=0))))
delete aspnet_users where username=(select username from {databaseOwner}{objectQualifier}users where userid=(select top 1 userid from {databaseOwner}{objectQualifier}userportals where isdeleted=1 and userid not in (select userid from {databaseOwner}{objectQualifier}userportals where isdeleted=0)))
delete {databaseOwner}{objectQualifier}userportals where userid=(select top 1 userid from {databaseOwner}{objectQualifier}userportals where isdeleted=1 and userid not in (select userid from {databaseOwner}{objectQualifier}userportals where isdeleted=0))
delete {databaseOwner}{objectQualifier}users where userid not in (select userid from {databaseOwner}{objectQualifier}userportals) and issuperuser=0
 
New Post
2/17/2011 5:15 PM
 
My guess is that those users have inserted data into a table that has a foreign key on the users table.  Have you looked in the EventLog to see if there is any more information stored on the error?

Overall, a SQL delete is not recommended as there are multiple tables that you have to modify.

-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
2/18/2011 2:52 AM
 
How do I find out what tables the users are linked to? I would like to get ride of them. The event log shows no errors.
 
New Post
2/18/2011 9:18 AM
 
I deleted users from the USERS table
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Help!!! CanHelp!!! Can't delete users


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