I want to revoke admin on a single profile, but there is no ‘revoke’ button. Other ‘Staff’ accounts on my site have a button.
Any idea why and how to fix please?
I want to revoke admin on a single profile, but there is no ‘revoke’ button. Other ‘Staff’ accounts on my site have a button.
Any idea why and how to fix please?
Just checking that you’re not trying to revoke admin access from the account you’re actively logged into?
No. It’s another account … I called it ‘Newsbot’, and it was used for pulling in RSS feeds.
I now want to remove those posts.
Does this account’s email exist in your app.yml
file as a developer? Or did you grand developer permissions via the console?
Users listed in the .yml
build file as DEVELOPERS
cannot be deleted from the UI for security reasons:
## TODO: List of comma delimited emails that will be made admin and developer
## on initial signup example 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: `incredible_undeletables@myamazingdomain.com'
You will need to remove them from the .yml
build file and rebuild.
Alternatively, but not recommended and not supported (I assume), is to change their admin status (boolean) in the users
table for that user to FALSE, directly in the database. Note: I have never done this (never revoked, but I have added moderators this way), but doing things like this (tinkering directly in the DB with things you are not totally familar with) could have unintended consequences, so this is not advised unless all else fails (and make sure 100% you have a working backup of the DB before you do!).
Check your .yml
file… the issue is more-than-likely there.
This user is not listed in my .yml file.
It’s so frustrating when even Admins are locked out from basic forum maintenance features.
Then, you might try something like this in the DB directly:
update users set admin = false where username = 'user_name_of_rouge_user';
where:
and:
This is what I would do if I had a rouge user with admin privs and I needed to revoke and could not do it in the admin panel.
A wild guess – did you happen to customize Discobot and rename it to Newsbot? The bot is considered as a system user, and you cannot revoke its admin status.
You can verify whether Newsbot is indeed discobot by going to its profile page, and check its email:
The bot’s email will be shown as discobot_email
.
Yes, that’s exactly what we did. This Discobot profile was used to pull in RSS feeds, which we now want to remove. The profile can remain, I just want all the posts/topics removed.
I’m not a developer, so simple steps would be greatly appreciated please.
OK, so you don’t actually about admin status here. Your goal is removal of posts? Suggestion for the future, let us know what you’re end goal is, not the current step you think will help you get there.
I don’t believe we have a rake task to delete all posts by a specific user. Let me test some things, I’ll get back to you.
OK. The following will allow you to delete all the posts by a user. You’ll need server access.
cd /var/www/discourse
sudo ./launcher enter app
rails c
newsbot
, if it isn’t, be sure to edit the command,id = User.find_by_username('newsbot').id
Post.where(user_id: id).each do |p|
PostDestroyer.new(Discourse.system_user, p).destroy
end;