Sorry but i am cross-posting my post on User authentication fórum (http://moodle.org/mod/forum/discuss.php?d=88193), just because now it is a enrollment plugin problem :
Hi
Need some help to enroll external users into existing courses.
I am syncing successfully the users from a external database users.
Now i am not enrolling these users into existing courses.
I have a course in moodle_course table with idnumber = "ct101"
and that is what i have in my external database too.
I have in my external database these collumns and this record:
id | user | course | firstname | lastname | email | city | country | enroll
8 991802 ct101 External Student external@domain.com New York US student
I run auth/db/auth_db_sync_users.php and the record was copied to moodle_user table,
(now i have this user in moodle user table with the value "db" in the auth collumn).
I run cron several times and receive the password. (did not understand yet when or why is done the password generation)
I run enrol/database/enrol_database_sync.php
I change the password at the first login .
I login again with the new password but i did not get enrolled with the expected course, whose idnumber value in moodle_course is ct101
My field mapping in course>enrollments is (local->remote):
idnumber->course
idnumber->user
shortname->enroll
Is there anything wrong ?
The only problem i have is that i do not get the user enrolled !
Thank´s in advance!
To enroll users i first must run enrol_database_sync.php
And after i must run admin/cron.php!
What exactly enrol_database_sync.php does and what exactly cron.php does?
The users will not be enrolled at a course untll cron.php runs, after enrol_database_sync.php have run ?
Re: User not enrolled by External Database Authentication
enrol_database_sync.php only deals with course enrolments from an external database. cron.php runs many different scheduled taks, and you should run it periodically (most people run it every 5 minutes).
For users to be enrolled in a course, the users have to exist in Moodle (so you might need to run auth_*_sync.php for this to happen) and then you can run enrol_database_sync.php.
Saludos. Iñaki.
Re: User not enrolled by External Database Authentication
So when running enrol_database_sync.php the already existing user data (sincronized from auth_*_user_syn.php) will be associated to the existing courses and the role_assignment table will be populated with the user, context-course data !?
As i choose internal method to manage password the user will receive the password after a cron running !?
Saludos. Ângelo.
On this setting : "Cron synchronization script Removed ext user"
How does these options works!
1. "Keep internal"
2. "Suspend internal"
3. "Full delete internal"
"Specify what to do with internal user account during mass synchronization when user was removed from external source. Only suspended users are automatically revived if they reappear in ext source."
During synchronization the users are deleted from moodle internal user table and we have three diferent ways to do it ?
that is it ?
how each of them work ?
Thank´s in advance
my mapping is working for only users only just into one course
When i have :
user | course
991802777 | ct101
991802777 | CF101
auth/db/auth_db_sync_users say Duplicatwed entry for user 991802777
I was expecting this user would get enrolled at the two courses .
Thank´s in advance
auth: (local->remote)
username field -> user
id number -> user
enrol: (local->value|remote)
course->idnumber|course
user->idnumber|user
I can assign one user to none course this is working fine !
My problem is that i can not assign one user to more than one course !
Actually it fails in auth/db/auth_db_sync_users.php if i have two records for the same username
How can i assign one user to more than one course ?
user_course table structure :
id
user
course
firstname
lastname
city
country
enroll
Settings:
Auth Enrol
Username field: user enrol_localcoursefield: idnumber
Password format: internal enrol_localuserfield: idnumber
Firstname: firstname enrol_db_localrolefield: shortname
Lastname: lastname
Email: email enrol_remotecoursefield: course
City: city enrol_remoteuserfield: id
Country: country enrol_db_remoterolefield: enroll
Nº ID: id
Thank´s in advance
Re: User not enrolled by External Database Authentication
I know I'm a bit late, but better late than never
You need to use two different tables: one for authentication and another one for enrolment.
The reason is the authentication code expects the user table has only one row for each user, with all the details for that user, but nothing related to courses
Then you have a separate table with the enrolment data, where you can have as many rows as you need for any user (in fact, you'll only need the user 'identifier' in this table).
Saludos. Iñaki.