# Cannot delete user who is in a group

**URL:** https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799
**Category:** Bug
**Created:** [January 23, 2018, 8:37pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799 "2018-01-23T20:37:14Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 23, 2018, 8:37pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/1 "2018-01-23T20:37:14Z")

</div>

Hey., @jomaxro, working with a hosted customer today we tried to delete a user.

There was a message that the user had posts and couldn’t be deleted, but there were no posts, but the user was in a group. When we deleted the user from group it was possible to delete the user.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [January 23, 2018, 8:40pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/2 "2018-01-23T20:40:33Z")

</div>

Any chance you grabbed the logs from the failed deletion? I can try again, but last I tried on try I was able to successfully delete a user who was in a group on [try.discourse.org](http://try.discourse.org).

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 23, 2018, 8:52pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/3 "2018-01-23T20:52:25Z")

</div>

Then it must have been gremlins.

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [January 23, 2018, 8:59pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/4 "2018-01-23T20:59:02Z")

</div>

I had that same issue:

[https://meta.discourse.org/t/cannot-delete-user-make-sure-all-posts-are-deleted/25233/62?u=omarfilip](https://meta.discourse.org/t/cannot-delete-user-make-sure-all-posts-are-deleted/25233/62)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 23, 2018, 9:00pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/5 "2018-01-23T21:00:35Z")

</div>

Yeah, but that’s SSO, so only the SSO master can delete users.

---

<div class="post-metadata">

### Author: ![omarfilip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/omarfilip/32/208019_2.png) [@omarfilip](https://meta.discourse.org/u/omarfilip)
#### Post date: [January 23, 2018, 9:03pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/6 "2018-01-23T21:03:20Z")

</div>

Hmm - could be. The user was created via SSO, but added to the group manually in Discourse. I was able to delete him only after removing him from the group.

BTW, the log is posted in the topic I linked.

---

<div class="post-metadata">

### Author: ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)
#### Post date: [March 14, 2018, 7:27pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/14 "2018-03-14T19:27:09Z")

</div>

Pretty sure I fixed this today. It happens when one of the groups the user belongs to grants a trust level.

[https://github.com/discourse/discourse/commit/5ce817766253e91b77273dd15d443d739387b5fa](https://github.com/discourse/discourse/commit/5ce817766253e91b77273dd15d443d739387b5fa)

The order of `dependent: destroy` matters. 💡

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 14, 2018, 8:32pm UTC](https://meta.discourse.org/t/cannot-delete-user-who-is-in-a-group/78799/16 "2018-03-14T20:32:13Z")

</div>


