Tuesday, July 2, 2024
HomeForAdministratorsLost Admin rights on your Moodle Site – Assign admin role to...

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).

Lost Admin rights on your Moodle Site – Assign admin role to other user
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.

How to use Moodle Book

 
Jaswinder Singh
Jaswinder Singhhttps://lmsdaily.com
I am an experienced Moodle Professional with experience in Moodle Course Creation, Moodle Setup, Moodle Integration, Moodle Training, Moodle Support & troubleshooting. YI am the author of popular books - "How to use Moodle 4.1" and "how to use Moodle 2.7". I work with one goal in mind “CUSTOMER SATISFACTION” – whether this means working to achieve results within a specific deadline (or beating the deadline), or with a focus on solid quality, if my client requires the job to be done I will go out of my way to achieving whatever it is that is necessary to do so. Basically, I can take care of your all Moodle requirements so that you can focus on your core job and I will manage your Moodle LMS.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -spot_img

Popular Posts

Authentica Solutions Raises $6.2M in New Funding to Expand Its Operations

Authentica Solutions, a leader in data integration and intelligence management solutions for the education sector, has recently announced the successful completion of a $6.2...

Moodle Admins – Create custom reports in Moodle using Configurable reports plugin

Moodle LMS is the most popular open source learning management system with more than 420+ million users in the world. Wherever elearning is used...

Moodle Teachers – How to use the Ordering Question type in Moodle

Moodle 4.4 - the latest major version of the Moodle LMS is packed with a lot of exciting new features. One of such is...