Create users through MYSQL

Re: Create users through MYSQL

by Fred Woolard -
Number of replies: 0

Mart,

I think you'll need to be more specific about what query you are using to insert the user. A simple one such as the following appears to work correctly in Moodle 2.0:

insert into mdl_user (auth, confirmed, mnethostid, username, password, firstname, lastname, email) values ('manual', 1, 1, 'joe', md5('joepassword'), 'Joe', 'Doe', 'joedoe@anonymous.edu')

If you look at the section of code I mentioned previously, you will see that the stored (mdl_user) md5 hash of the user password is compared successively to the submitted password with and then without the $CFG->passwordsaltmain salt, and then again using addslashes() in addition on the submitted password.