Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Pascal K. 3 posts 23 karma points
    May 01, 2010 @ 13:41
    Pascal K.
    0

    hey there,

    I've a question in using the usersarea. How can I delete users? I don't want to deactivate them. I want to delete.

    Thank you for the coming response.

     

    PS. Sorry my English isn't perfect I know. I really hope, that you understood what I want to do.

  • Dan 1285 posts 3917 karma points c-trib
    May 01, 2010 @ 17:04
    Dan
    1

    It's not possible to completely delete users via the Umbraco UI.  This is because users may have data associated with them throughout the system (e.g if a user modifies a page, the modification will be saved alongside the user as part of the audit trail).  To delete a user may corrupt the audit trail.  So if you need to delete a user, check first for dependencies, then delete via the database directly.

    Hope this helps...

  • Pascal K. 3 posts 23 karma points
    May 01, 2010 @ 17:28
    Pascal K.
    0

    Thank you for your response.

    the users that i want to delete are useres i onely createt for testing reasons.

    There were no posts ore something else i did with them.

    so were can i delete them in the database directly?

     

    looking for a reponse :D

  • Dan 1285 posts 3917 karma points c-trib
    May 01, 2010 @ 21:05
    Dan
    0

    The 'umbracoUser' table should be the one you want.

  • Pascal K. 3 posts 23 karma points
    May 02, 2010 @ 11:11
    Pascal K.
    0

    sorry but i can't find it in the ftp.

    where should i search for it ?

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    May 02, 2010 @ 12:42
    Dirk De Grave
    0

    users are stored in the database, not on file system. As Dan points out, look for the umbracoUser table in the umbraco database.

     

    Cheers,

    /Dirk

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    May 02, 2010 @ 12:44
    Dirk De Grave
    1

    Oh, btw, still don't like the idea of deleting users.. if you want to get rid of those in the admin backend, here's another idea I've implemented a while ago:

    Build your own loadUsers functionality to NOT show disabled users.

     

    Cheers,

    /Dirk

  • Richard Barg 358 posts 532 karma points
    Sep 19, 2012 @ 02:33
    Richard Barg
    0

    There is really no reason to use brute force to remove users (user-ids) from the database and effectively remove important historical information from documents. - if you "Disable a User" in user admin, then when you refresh the list of users, that user is gone. The user is still in the database, but the user list is effectively pruned.  There is no reason to delete those entries in the database as they like are benign cysts of the kidney. They aren't causing any problems so surgeons don't remove them. Altering Umbraco code via loadUsers is completely unecessary as disable user does the same thing - it would appear.

    One would thus invoke the old saying, "out of sight - out of mind".  Test edit

  • Sébastien Richer 194 posts 430 karma points
    Oct 15, 2012 @ 21:42
    Sébastien Richer
    6

    I'd like to pitch in here, I have to disagree with most people, saying that there is no need to delete a user. I use Umbraco in a business way, I mean I build websites using it, then I "deliver" the websites to the clients. Two things happen here:

    First I have to clean the database of test users / development users before I deliver to the client. I can ignore those oldusers, but the client has all the right to not want these "remains" from the development of his website lying around. Imagine if you bought a new house and you could not "clean it". So I understand completely the technical value of keeping hisroty and such, but the reality is that in a development state, I want to loose that history as it is not yet relevant.

    Secondly, I create a base Umbraco project from which I "launch" all my new projects, these allow me to offer more functionnality to my clients with less time / cost. But from this "base" project, I have development users that I want to delete and again, I cannot. There are also issues when I'm rebasing my "base" project, these users will / may get carryed over.

    I'm not expecting a smooth workaround / solution but I want to re-align the discussion into real-world client delivery processes where things like this do matter.

    Cheers!

  • Francisco 21 posts 72 karma points
    Feb 12, 2013 @ 02:34
    Francisco
    0

    You have a good point Sebastien!

    I have the same problem here.

    Cheers!

  • martin uhe 7 posts 27 karma points
    Apr 29, 2013 @ 07:28
    martin uhe
    0

    I second Sebastien.

    Has anyone used F.L.A.M Hosekeeping? I attempted to install it with Umbraco 6.0.3 with no luck unfortunatly :-(

     

     

     

     

     

  • Funka! 398 posts 661 karma points
    Apr 30, 2013 @ 20:01
    Funka!
    1

    Here's how I do this. This method does preserve things like audit trail, but re-assigns these back to the initial admin user (User ID #0) so that nothing really "breaks".

    Note, the script below deletes ALL users other than this initial user, but with limited SQL knowledge you can adjust to target just the user you want.

    -- don't nuke these records, but can re-assign back to "admin" master user (or whoever else)
    UPDATE umbracoNode SET nodeUser = 0 WHERE nodeUser > 0
    UPDATE cmsDocument SET documentUser = 0 WHERE documentUser > 0
    -- these can be nuked
    DELETE FROM umbracoLog WHERE userId > 0
    DELETE FROM umbracoUser2App WHERE [user] > 0
    DELETE FROM umbracoUserLogins WHERE userID > 0
    DELETE FROM umbracoUser WHERE id > 0

    P.S. not recommended if you're not comfortable with SQL. This works on version 4.11, can't guarantee 6 or above yet.

    Best of luck!

  • Funka! 398 posts 661 karma points
    Apr 30, 2013 @ 20:04
    Funka!
    0

    I forgot to mention, you should first disable/se-activate the user in the Users section of the backend. THEN run this script.

     

  • philw 99 posts 434 karma points
    Jul 14, 2013 @ 17:12
    philw
    0

    I sorted this one by opening up the database and deleting the rows for the users I needed to remove. There's some foreign key dependency, so you will get an error message when you try to delete each user. Just check the user ID, then the error message, and then delete the other entry first. In my case my bad user just had a mapping from user -> "application" (which was one of those "content"/ "media" things. I zapped that, and now that bad user's gone.

  • Robert Lundberg 14 posts 60 karma points
    May 07, 2015 @ 17:01
    Robert Lundberg
    0

    Hi,

    Anyone have some updates or insights on removing users from an umbraco 7 site?
    We have alot of users that we would like to remove. Is the script way a possible solution, and if it is,
    what to watch out for?

    regards

    Robert

  • Walter 8 posts 79 karma points
    May 10, 2017 @ 17:44
    Walter
    0

    Using umbraco for a business knowledge base. Would be nice to at least be able to organize the disalbed users into a seperate folder or hide them from the user list if one is not able to delete them.

  • Marcin Zajkowski 112 posts 585 karma points MVP 6x c-trib
    Jul 10, 2018 @ 06:20
    Marcin Zajkowski
    4

    Just for the record: it has slightly changed in the latest versions of Umbraco. I've used a below snippet to perform a cleanup of all users despite of the admin (userId: 0) user.

    UPDATE umbracoNode SET nodeUser = 0 WHERE nodeUser > 0
    UPDATE cmsDocument SET documentUser = 0 WHERE documentUser > 0
    
    DELETE FROM umbracoLog WHERE userId > 0
    DELETE FROM umbracoUserStartNode WHERE [userId] > 0
    DELETE FROM umbracoUser2NodeNotify WHERE [userId] > 0
    DELETE FROM umbracoUser2UserGroup WHERE [userId] > 0
    DELETE FROM umbracoUserLogin WHERE userID > 0
    DELETE FROM umbracoUser WHERE id > 0
    
  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jul 10, 2018 @ 06:26
    Jan Skovgaard
    1

    Hi Marcin

    How will the above SQL snippet affect content nodes that have been created by the deleted users?

    /Jan

  • Marcin Zajkowski 112 posts 585 karma points MVP 6x c-trib
    Jul 10, 2018 @ 06:27
    Marcin Zajkowski
    1

    That's a very good question. This script won't. It needs to be updated and contain the lines from the previously shared in this thread one.

    In my case - there is no content yet :) I'll update my answer. Thanks for spotting it!

  • Murray Roke 502 posts 965 karma points c-trib
    May 02, 2019 @ 02:22
    Murray Roke
    0

    Here's a slightly more complicated script that will delete all disabled users (except the one you nominate) and it will re-assign all the 'blame' to that one

    declare @deletedRepresentativeId int = 1 -- make sure this is a user you don't want.
    
    update umbracoUser set userName = 'Delted User', userLogin='20190502__', userEmail = '[email protected]' where id = @deletedRepresentativeId
    
    declare @userIdsToDelete TABLE (id int)
    Insert into @userIdsToDelete (id) select id from umbracoUser where userDisabled = 1 AND id != @deletedRepresentativeId
    
    --select * from umbracoUser where Id in (select id from @userIdsToDelete)
    
    -- select *
    delete
    from [umbracoUser2UserGroup]
    where userId in (select id from @userIdsToDelete)
    
    -- select *
    delete
    from [umbracoUserStartNode]
    where userId in (select id from @userIdsToDelete)
    
    -- select *
    delete
    from [umbracoUserLogin]
    where userId in (select id from @userIdsToDelete)
    
    update umbracoNode
    set nodeUser = @deletedRepresentativeId
    where nodeUser in (select id from @userIdsToDelete)
    
    update [cmsDocument]
    set documentUser = @deletedRepresentativeId
    where documentUser in (select id from @userIdsToDelete)
    
    update [umbracoLog]
    set userId = @deletedRepresentativeId
    where userId in (select id from @userIdsToDelete)
    
    delete from umbracoUser where id in (select id from @userIdsToDelete)
    
  • Robert Godino 40 posts 129 karma points
    Jul 30, 2020 @ 22:25
    Robert Godino
    0

    Hi Murray,

    On the 2nd line, should this read:

     userName = 'Deleted User'
    

    instead of:

     userName = 'Delted User'
    

    Also, I’m assuming I’ll need to change both these properties to the Id and Email of the admin I’d like to retain?:

    userLogin='**20190502__**', userEmail = '**[email protected]**'
    
Please Sign in or register to post replies

Write your reply to:

Draft