How to activate and unstage accounts for imported users

Hello,

I imported posts from a mailing list and users have been successfully created.
But now there are in “staged” list.

So i can activate them one by one, but how to activate them in bulk mode ?
And how to unstage them too ? I don’t see any button to unstage a user.

Then, users are in my pending list and even then, is there a way to approve them in bulk ?

Thanks.

1 Like

the easy way is to use the data explorer

https://github.com/discourse/discourse-data-explorer.git

1 Like

The data explorer plugin does not let you modify data.

Administrative Bulk Operations should have some hints.

Something like

User.all.update_all(active: true)

might do it.

4 Likes

That might do it but if emails haven’t been validated prior, during, or after the import, then there will be trouble. It will probably work with a mailing list but it’s not best practice to do this in general.

The recommended approach is to encourage your users to come to the site and create an account with the email they used on the mailing list. If the email matches the email of a staged user, the user will assume control of the staged account. If not, a new account will be created.

5 Likes

Just for the record, @Julien_J, I answered your question, but Justin’s is a better answer!

2 Likes

Hello,

I went to try to invite all users.
They well received the invite email but when they try to create an account with name and password, when they click on “Accept invite”, nothing’s happening.

So i tried to invite somebody that is not already a staged user and here it’s working fine.

If i watch the Chrome console, i can see an error like that

_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:10113 PUT https://www.domain.tld/invites/show/f38d1e480cd9fb2d218c0d7aeddafded.json 500
send @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:10113
ajax @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:9696
i @ _application-fe142cfba5f192f0e63470885009a5a5bfbf952412fc41b59ea670a3ae4c7e27.js:9027
(anonymous) @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:72238
n @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:72760
r @ _application-fe142cfba5f192f0e63470885009a5a5bfbf952412fc41b59ea670a3ae4c7e27.js:9041
submit @ _application-fe142cfba5f192f0e63470885009a5a5bfbf952412fc41b59ea670a3ae4c7e27.js:34690
t._join @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:67257
t.join @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:66968
f @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:53760
(anonymous) @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:20968
r @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:50091
(anonymous) @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:20967
click @ _application-fe142cfba5f192f0e63470885009a5a5bfbf952412fc41b59ea670a3ae4c7e27.js:49429
trigger @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:46074
e @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:43433
t._run @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:67275
t._join @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:67251
t.join @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:66968
f @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:53760
(anonymous) @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:46175
r @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:50091
handleEvent @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:46171
handleEvent @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:45108
(anonymous) @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:45498
dispatch @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:5443
v.handle @ _ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:5247
_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:38545 Uncaught Error: [object Object]
    at _application-fe142cfba5f192f0e63470885009a5a5bfbf952412fc41b59ea670a3ae4c7e27.js:34720
    at E (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:72211)
    at w (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:72194)
    at g (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:72130)
    at t.invoke (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:66552)
    at e.t.flush (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:66442)
    at e.t.flush (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:66646)
    at e.t._end (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:67222)
    at e.t.end (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:66908)
    at e.t._run (_ember_jquery-1ed3f3559e6f967733b4088aa729ff7039dff2c09c5a5f787a214b016f58aabc.js:67277) 

I’m on the the latest-release +486.

And I went to see logs where I have:
Message (5 copies reported)

Reviewable::InvalidAction (Can't peform `approve_user` on ReviewableUser)
app/models/reviewable.rb:346:in `perform'
app/models/invite_redeemer.rb:149:in `approve_account_if_needed'
app/models/invite_redeemer.rb:81:in `process_invitation'
app/models/invite_redeemer.rb:8:in `block in redeem'
app/models/invite_redeemer.rb:6:in `redeem'
app/models/invite.rb:85:in `redeem'
app/controllers/invites_controller.rb:52:in `perform_accept_invitation'
app/controllers/application_controller.rb:350:in `block in with_resolved_locale'
app/controllers/application_controller.rb:350:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:328:in `call'
config/initializers/100-quiet_logger.rb:19:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
lib/middleware/request_tracker.rb:176:in `call'

Backtrace

app/models/reviewable.rb:346:in `perform'
app/models/invite_redeemer.rb:149:in `approve_account_if_needed'
app/models/invite_redeemer.rb:81:in `process_invitation'
app/models/invite_redeemer.rb:8:in `block in redeem'
activerecord (6.0.3.2) lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `block in transaction'
activerecord (6.0.3.2) lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
activesupport (6.0.3.2) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
activesupport (6.0.3.2) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
activesupport (6.0.3.2) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
activesupport (6.0.3.2) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'

Env

HTTP HOSTS: www.domain.tld

Otherwise, if the staged user try to use password forgotten function to use a new password, he gets a user not found…

Do you have an idea how to solve that ?

@Julien_J DM me your site address and let me see if I can help you

Hello,
I have the same issue. Did you solve it somehow? Thank you! :slight_smile:

he still has not DM’d me. so either he came right or it is still pending

Hello, I’m sorry for my non-answer.
In fact my forum is only in private mode, so it’s difficult to do something with the URL.

As you can see in my previous messages, the invitation was well received but the users couldn’t do anything with it.To resolve it, and because I’m on a small list with less than 10 users, I modified the email for each user with an email of mine (with dynamic alias on Gmail like myemail+user1@gmail.com), and use forgot password to set a password, and then change the email to put the good user email address.

It’s not a good way but it’s work.

1 Like

Sorted in

2 Likes