Hi all, so I wanna add users from a database of another web application to my moodle instance, so I need to do some sort of mapping between the fields of the user table... So what are the api's that I need to work with? any tips?
Is this a once-off migration that you are doing, or will you need to do it regularly?
If it's a once-off job, try exporting the user details from your other web application into a Moodle compatible .csv file. See: https://docs.moodle.org/31/en/Upload_users#Valid_upload_file_for_testing for details.
Then you can import that .csv file into Moodle to create the users in Moodle.
Ty for your response but It's not a once-off migration.
So you want to "synchronise" your Moodle database with an external database?
Try this: https://docs.moodle.org/31/en/External_database_authentication
If the users in your external database aren't in Moodle then they will be created in Moodle. Is that what you want?
Yes that's exactly what I want. I will see the link that you suggested. ty
Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) in C:\inetpub\wwwroot\moodle\lib\adodb\drivers\adodb-mysql.inc.php on line 462
127.0.0.1: Access denied for user 'root'@'localhost' (using password: YES)
Works fine now.
You might have to do some programming if your case is elaborate like ours is. We have a student/school management system that is our back office app. Many conditions occur that will cause a student to be enrolled or unenrolled into particular courses, plus also we have those issues of when a student is suspended or deleted, for variety of reasons. So I had to write a series of programs to do everything including the exporting of student data from our back office application to a CSV, then read that CSV in with the importing program and then to create accounts if not already created, enroll/unenroll, suspend or unsuspend as the case might be.
If you want to go down that road to gain the benefits of controlled enrollments and suspensions, etc, let me know and I'll provide some more pertinent information that will help you get that ball rolling.
Yeah Perry, it would be awesome if you can give us some information. ty
We handled a similar situation a little differently - but it would totally depend on the back-end of your SIS.
In our case (using an SIS called Quercus, which is based on an Oracle database), our Admin team created a report in the back-end that takes all such considerations into account (or whichever ones are relevant to our situation - campus, suspensions, payments, etc). That report then gives a table in the back-end database and I simply use Moodle's external database for automatic course creation and enrolment.