Copied to clipboard

Flag this post as spam?

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


  • JoskerVemeulen 67 posts 261 karma points
    Oct 21, 2019 @ 08:51
    JoskerVemeulen
    0

    Hi,

    I have some test users in my V8 umbraco setup. As admin I can only disable these users. Is there an option to delete these users? I can't seem to find this option.

    Thanks you.

  • JoskerVemeulen 67 posts 261 karma points
    Nov 06, 2019 @ 10:49
    JoskerVemeulen
    0

    Any one?

  • Steven Salim 4 posts 74 karma points
    Dec 30, 2019 @ 22:12
    Steven Salim
    0

    +1 I am also looking for the same answer

  • Matt 315 posts 737 karma points
    Dec 31, 2019 @ 07:51
    Matt
    0

    I dont think you can delete users. this is because of the impact it has on the audit table and associated content items, such as who created them, last updated them etc.

    I believe you can hide all disabled users.

  • Thomas 247 posts 517 karma points c-trib
    May 19, 2020 @ 09:32
    Thomas
    0

    Do you then change the name and email for the disabled user??

    Now that you cant delete the user? I'm thing off GDPR laws here ?..

  • Jesse Andrews 174 posts 663 karma points
    Aug 10, 2020 @ 19:52
    Jesse Andrews
    6

    It is possible, though it does require running a sql script. Below is the script I use.

    DECLARE @userId AS INT = 1
    UPDATE umbracoNode SET nodeUser = -1 WHERE nodeUser = @userId
    UPDATE umbracoContentVersion SET userId = -1 WHERE userId = @userId
    DELETE FROM umbracoLog WHERE userId = @userId
    DELETE FROM umbracoUserStartNode WHERE [userId] = @userId
    DELETE FROM umbracoUser2NodeNotify WHERE [userId] = @userId
    DELETE FROM umbracoUser2UserGroup WHERE [userId] = @userId
    DELETE FROM umbracoUserLogin WHERE userID = @userId
    DELETE FROM umbracoUser WHERE id = @userId
    

    This script removes the user completely from the system by updating the resources that can't be deleted to point at the root user and then deleting all connected table entries. If the umbracoLog table needs to be preserved, it can be changed to

    UPDATE umbracoLog SET userId = -1 WHERE userId = @userId
    

    To get the id of the user, just visit the user in the backoffice. The user's id can be seen in the url (/umbraco/#/users/users/user/{user id}).

  • Ricardo Marcelino 15 posts 73 karma points
    Oct 13, 2020 @ 17:58
    Ricardo Marcelino
    0

    Thanks for the script, spot on!

  • Kareem 1 post 71 karma points
    Oct 21, 2021 @ 10:05
    Kareem
    0

    Thanks Jesse for sharing and I'd like to add a minor update in case your site instance supports multiple cultures then you will need to add this as well

    UPDATE umbracoContentVersionCultureVariation SET availableUserId = -1 WHERE availableUserId = @userId
    
  • David Armitage 479 posts 2008 karma points
    Nov 13, 2020 @ 02:08
    David Armitage
    1

    Worked a treat. Thanks Jesse

Please Sign in or register to post replies

Write your reply to:

Draft