Home For Administrators Lost Admin rights on your Moodle Site – Assign admin role to other user

Lost Admin rights on your Moodle Site – Assign admin role to other user

0
Lost Admin rights on your Moodle Site – Assign admin role to other user
Lost Admin rights on your Moodle Site – Assign admin role to other user

While upgrading the Moodle LMS to a new version or testing a new plugin on your site, there  may be chances when you might have accidentally lost access to your admin account. And you couldn’t reset it without any means like the forget password option also not working. In this post we will see how you can assign admin role to any user in your Moodle.

While testing an authentication plugin on my development Moodle, I was also stuck up with no login for my admin account. Luckily, I have another test user with a student role, so by using the tip mentioned below, I was able to upgrade the student account as an admin and later recovered my main admin account.

However, in order to use this handy tip, you need to make sure that you know the ID of the new user whom you want to elevate as site admin.In case you don’t know the ID of the user, then you can find it out from the Moodle database in table mdl_user (where mdl is your database prefix).

Add this line in config.php file

Once you are having the ID, then follow the steps below:

  • Navigate to Config.php file of your Moodle site (it is located in the root directory of your Moodle site)
  • Now, open the file in a text editor like Notepad etc.
  • Add the following line in your config.php file where 2 is the original admin user established when first installing, and [yourotheradminid] the ID number of the other user you setup as admin levels –
$CFG->siteadmins='2,[yourotheradminid]';
  • Save your config.php file and login with your student credentials. You will see the admin privileges.

What are the other handy tips you have to share with the Moodle community? Please let us know in the comments section below.

For regular updates about Moodle, eLearning and edtech industry, please visit us regularly at https://lmsdaily.com. You can also like us on Facebook or follow us on Twitter, or Subscribe our YouTube Channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exit mobile version