Bulk Updates to User Authentication in #Moodle

Image Source: http://wamsoftinc.com/images/authenticate.jpg
Wondering what steps to take to change the way users "authenticate" in Moodle from LDAP to Manual or vice versa? Sometimes, it's necessary to do mass updates to your users that you don't want to do one by one and/or the bulk update tool isn't appropriate.

In the screenshot above, notice that "auth" column reflections how users are authenticating in Moodle. You can change that authentication in one fell swoop rather than going one by one...this is handy when you're dealing with more than 20 users.

To switch authentication in bulk, you can do that in a tool like PHPMyAdmin. I had to do that once or twice before we switched to LDAP authentication for students.

Some SQL commands to find and update user authentication....

To FIND users (the WHERE command is critical since what you find is what you can update):
  • SELECT * FROM `mdl_user` WHERE auth='manual'
    This will give you a list of everyone who has authentication set to manual. You could switch 'manual' to 'ldap' and get corresponding results.
To UPDATE users, you can use the command below. Notice that the WHERE command should be identical to the one you used to FIND users. This helps ensure you're not accidentally wiping out other users.
  • UPDATE 'mdl_user'
    SET auth='ldap'
    WHERE auth='manual'

    This update command will change everyone who is LDAP authenticated to manual. If you switch 'ldap' with 'manual' you will get the opposite result.
As always, while it's fun to play with MySQL commands, make sure to make a backup of the mdl_user table (SQL dump) before starting down this road.

Get Blog Updates via Email!
Enter your email address:
Delivered by FeedBurner

Everything posted on Miguel Guhlin's blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure


Paul said…
"UPDATE 'mdl_user'
SET auth='ldap'
WHERE auth='manual'
This update command will change everyone who is LDAP authenticated to manual."
This is not true. You should say "This update command will change everyone who is manual authenticated to LDAP".

Popular posts from this blog

#Chromecast Add-Ons to Play Various Video File Formats

Free Professional Learning! Education On Air #googleedu

10 Steps to a Blended Learning Classroom #MIEexpert #MIE #tceamie1