External DB for enroll user on course

External DB for enroll user on course

by Farhad Fataev -
Number of replies: 2

Hello everyone! I want to enroll users on courses with help external DB. I record in external table id course and my id(I'm admistration).  Established a connection with my DB(the moodle sees my db). After that, I go to the site on behalf of the student, but there is no course in my profile. Can you tell me how it works?

Average of ratings: -
In reply to Farhad Fataev

Re: External DB for enroll user on course

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
A couple of things. It looks like you're using the primary key ID fields from the course and user table. Double check. It's unusual for an external database to know anything much about the internal workings of Moodle. It's more usual to use the course and user idnumber fields. And these need to be mapped in your settings (https://docs.moodle.org/310/en/External_database_enrolment#Field_Mapping_Example).
Second, your external db table doesn't reference any role identifier. This is usually the role shortname. Again this needs to be mapped.
Third, ensure that the cron is running. You can run it manually from the UI to test.
In reply to Mark Sharp

Re: External DB for enroll user on course

by Farhad Fataev -
Thanks, the problem was that he was syncing, only once a day. I want it to be more often. I have moodle 3.11.5. I go into the task scheduler and try to change, but the changes do not take effect, writes that it is disabled. There are ways to solve this issue. Thanks!