• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Promote to admin via database

#1
Hi, is there a way to promote myself to admin running a sql query? Also, I was deleted from my board...could I restore my account somehow?
 

Mike

XenForo developer
Staff member
#2
It's not trivial to re-add yourself as an admin. It really needs to be done via the interface. It should not be possible to delete the last admin user, so another admin should be able to make you an admin.

There's no way to restore your account if it's deleted.
 
#3
It's not trivial to re-add yourself as an admin. It really needs to be done via the interface. It should not be possible to delete the last admin user, so another admin should be able to make you an admin.

There's no way to restore your account if it's deleted.
Sooo...I guess i'm just locked out? :S What should I do to get back in?
EDIT: I have cPanel/FTP/Full server access if that's any help.
 

Brogan

XenForo moderator
Staff member
#4
Is the other admin not able to set your new account as an administrator?

You could always import a backup from before your account was deleted, but of course you will lost any content, members, etc. created since then.
 
#5
Is the other admin not able to set your new account as an administrator?

You could always import a backup from before your account was deleted, but of course you will lost any content, members, etc. created since then.
The other admin doesn't want me back in the site lol.
 

Mike

XenForo developer
Staff member
#6
You need to set your user ID up as a super admin in config.php (you should see an example in there, it's comma delimited).

Your record in the xf_user table needs to have is_admin = 1.

You need to have a record corresponding to your user id in the xf_admin table.

(Note, untested :))
 

Dr.Yontem

Formerly Tilkißey
#7
You need to set your user ID up as a super admin in config.php (you should see an example in there, it's comma delimited).

Your record in the xf_user table needs to have is_admin = 1.

You need to have a record corresponding to your user id in the xf_admin table.

(Note, untested :))
see below post

and, adding 3 steps to this steps / for my idea
edit 3 defines from xf_user template (in ur id's row)
i dont remember all of them names clearly and i cannot access to phpmyadmin coz of my net connection settings

admin usergroup id = 4 in default
so, u ve to edit ur usergroup id to 4
and, edit ur showing user group id to 4
and, edit ur permission id to 4

is it right Mike?
 

Mike

XenForo developer
Staff member
#8
In terms of getting into the admin CP, that doesn't matter. I was assuming the necessary configuration would be done after the admin was setup.
 

jeffwidman

Active member
#10
You need to set your user ID up as a super admin in config.php (you should see an example in there, it's comma delimited).

Your record in the xf_user table needs to have is_admin = 1.
FYI for anyone later googling this--this is all you need to do to get into the ACP. Once you're in, then go to Users > Admins and add your user as an admin. It will fill out the xf_admin table values correctly once you add yourself as an admin.