# Staged users remain staged even after activation and must be manually unstaged

**URL:** https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714
**Category:** Bug
**Created:** [September 25, 2017, 9:31am UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714 "2017-09-25T09:31:56Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [September 25, 2017, 9:31am UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/1 "2017-09-25T09:31:56Z")

</div>

This is similar to:

> [@User stuck in 'staged' status](https://meta.discourse.org/t/user-stuck-in-staged-status/41594):
>
> I have a user whose account was originally created as a staged account via an import from another system. Recently, they logged in and created a new topic. But they still show up as a staged user, and I cannot @mention them. I do not see any way in the Admin UI to force them to become “unstaged”. Potentially relevant site settings: Google Login enabled Local logins disabled Email whitelist domains (1) Currently running version v1.5.0.beta13b +38 (67a5fc39ded9f661974b6e06b109c75b50d3a1b1)

except that when a user is _staged_, meaning that it came in via `email in`, and after their account is activated (either by the admin or by sending out an activation email which they reacted to), they can log into the system and do things like a regular user.

Except that they user account stays _staged_. There is no way to clear the _staged_ flag.

So, user needs to be automatically unstaged not only when loggin in via OAuth, but simply when they are activated via any means.

---

<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: [September 26, 2017, 2:53am UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/2 "2017-09-26T02:53:22Z")

</div>

What do you think @zogstrip?

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [October 3, 2017, 10:22am UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/4 "2017-10-03T10:22:13Z")

</div>

Just in case other people needs to manually _unstage_ a user:

#### Step 0: SSH to your VM

```plaintext
ssh my.discourse.domain.com

```

#### Step 1: Enter the discourse container

```plaintext
cd /var/discourse
sudo ./launcher enter app

```

#### Step 2: Enter the Rails console

```plaintext
rails c

```

#### Step 3, Option 1: Unstage the user by email address

```plaintext
User.find_by_email("email@address.com").update(staged: false)

```

#### Step 3, Option 2: Unstage the user by username

```plaintext
User.where(username: "username").update_all(staged: false)

```

#### Step 4: Finito, get out

Press `^D` a few times to get back out.

---

<div class="post-metadata">

### Author: ![jordan1909](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jordan1909](https://meta.discourse.org/u/jordan1909)
#### Post date: [November 7, 2017, 2:38pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/5 "2017-11-07T14:38:37Z")

</div>

@schungx

Is this still accurate? I was trying to do this and keep getting: undefined method `update" for nil:NilClass

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [November 7, 2017, 2:54pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/6 "2017-11-07T14:54:39Z")

</div>

AFAIK this is still true.

If you got a `nil` error on `update`, then it is likely that you mis-typed the email address. `User.find_by_email` didn’t find it and so returned `nil`.

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [May 12, 2018, 6:59pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/7 "2018-05-12T18:59:37Z")

</div>

Anyone in team gonna take a look at this?  
It seems to be still not fixed.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [May 13, 2018, 3:00pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/8 "2018-05-13T15:00:47Z")

</div>

We’ll now always unstage user when they log in 🍌

[https://github.com/discourse/discourse/commit/2cf6fb7359a8ad6ea9ee7b33ce645eece50ece44](https://github.com/discourse/discourse/commit/2cf6fb7359a8ad6ea9ee7b33ce645eece50ece44)

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [May 13, 2018, 9:47pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/9 "2018-05-13T21:47:49Z")

</div>

Great. This is a great help.

There is one more issue. For staged uses, pressing the Send Activation Email button doesn’t send the email. The email logs show that the signup email has been sent, but the email is actually not sent.

I wonder if it is filtered out somewhere.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [May 16, 2018, 9:28pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/12 "2018-05-16T21:28:00Z")

</div>

Just tried and it worked fine. Was your sidekiq queue full?

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [May 22, 2018, 3:43pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/13 "2018-05-22T15:43:57Z")

</div>

Not really… It is just that the email is not sent, but it says sent in under Email-\>Sent.

Sidekiq not full.

The only way I get to invite staged people right now is 1) Activate them by hand, 2) Press Send Password Reset email.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [May 22, 2018, 3:44pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/14 "2018-05-22T15:44:57Z")

</div>

> [@schungx](#):
>
> It is just that the email is not sent, but it says sent in under Email-\>Sent.

Have you checked the logs of your SMTP provider/API?

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [May 22, 2018, 3:45pm UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/15 "2018-05-22T15:45:58Z")

</div>

I’ll go do some more digging around after I upgrade to the latest and greatest.

It is strange that the Password Reset email got sent IMMEDIATELY, while the activation emails don’t ever get sent/received.

---

<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: [July 9, 2018, 9:26am UTC](https://meta.discourse.org/t/staged-users-remain-staged-even-after-activation-and-must-be-manually-unstaged/70714/16 "2018-07-09T09:26:01Z")

</div>


