Info
Content

Add Site Admins through cfg.php tool


You can use the site configuration admin/cli/cfg.php tool to add a site admin if you know the user's Moodle user id.

Here's a quick example

php admin/cli/cfg.php | grep siteadmins
siteadmins	2,669,2104,3328,4350

This gives us the user ids that are currently siteadmins (e.g id 2 is the admin user).

Now lets add the user id, 5000 to this list, making sure that we retain the the other ids (otherwise they will lose site admin!).

php admin/cli/cfg.php --name=siteadmins --set=2,669,2104,3328,4350,5000

Then verify the list again:

php admin/cli/cfg.php | grep siteadmins
siteadmins	2,669,2104,3328,4350,5000
Make sure you keep the existing list of user ids for site admins or those users will lose access.
No Comments
Back to top