How to log out all members?


(Wiliam Joaquim) #1

I need all members to be logged in, so that they create their account in memberful, how do I?


(Matt Palmer) #2

Enable memberful SSO (however that needs to be done), disable local logins, disable anonymous mode.


(Wiliam Joaquim) #3

I need to log out on all users, but doing one by one is tiring, can you log out all at once?


(Felix Freiberger) #4

This should be enough to log out all users, with the possibility of exempting some users:

protected_users = ["system", "codinghorror"] # do not process these users

# get all users that should be logged out
affected_users = User.all.select { |u| !(protected_users.include? u.username) }

affected_users.each { |u|
        u.user_auth_tokens.destroy_all
        u.logged_out
};

This needs to be run within Rails – pasting it into a rails console (./launcher enter app, rails c) should be enough.

Better safe than sorry: Always have a backup ready before going near the Rails console.


(Alex Armstrong) #5

Will this work with SSO as well?

Sam elsewhere suggests nuking a couple of other values as well: