External DB enrol problems

External DB enrol problems

by Dale Davies -
Number of replies: 4
Ive been trying to set up external db enrolment, I thin I may have found a bug. The plugin connects fine, but does not enrol the student.

Well it says it has but the course neither shows up on the students My Moodle page, or the student in the Assign Roles page of the course.

I have enabled all the error log messages in enrol.php and I get the following when I try to log the user in for the first time...

Fri Sep 05 14:54:20 2008] [error] [client 10.50.4.155] [ENROL_DB] found 1 roles:, referer: http://moodle.liv-bus.co.uk/login/index.php
[Fri Sep 05 14:54:20 2008] [error] [client 10.50.4.155] [ENROL_DB] setting up enrolments for , referer: http://moodle.liv-bus.co.uk/login/index.php
[Fri Sep 05 14:54:20 2008] [error] [client 10.50.4.155] [ENROL_DB] Using config default for roles: student, referer: http://moodle.liv-bus.co.uk/login/index.php
[Fri Sep 05 14:54:27 2008] [error] [client 10.50.4.155] [ENROL_DB] Found 0 existing roles and in external database, referer: http://moodle.liv-bus.co.uk/login/index.php
[Fri Sep 05 14:54:27 2008] [error] [client 10.50.4.155] [ENROL_DB] Enrolling user in course IT100C, referer: http://moodle.liv-bus.co.uk/login/index.php

Then after this I get the same but with this message...

[Fri Sep 05 14:55:47 2008] [error] [client 10.50.4.155] [ENROL_DB] User is already enroled in course IT100C, referer: http://moodle.liv-bus.co.uk/

However, this is intermittent. Sometimes I only get the following...

[Fri Sep 05 15:02:48 2008] [error] [client 10.135.7.32] [ENROL_DB] found 1 roles:, referer: http://moodle.liv-bus.co.uk/
[Fri Sep 05 15:02:48 2008] [error] [client 10.135.7.32] [ENROL_DB] setting up enrolments for , referer: http://moodle.liv-bus.co.uk/
[Fri Sep 05 15:02:48 2008] [error] [client 10.135.7.32] [ENROL_DB] Using config default for roles: student, referer: http://moodle.liv-bus.co.uk/


Geting moodle to connect to the oracle database was easy, but I really dont know where to go from here! Thanks for your time in answering this, if anyone has a clue Id really appreciate your input.

Average of ratings: -
In reply to Dale Davies

Re: External DB enrol problems

by Dale Davies -
Perhaps I should give a few more details.

Ive recently moved our moodle and our mysql database from a windows server to linux. I have also upgraded Moodle to version 1.9.2 from version 1.8. I am also using Apache 2, PHP 5.2.4, MYSQL 5.0.51a. This is running on Ubuntu Server 8.04.

I have also applied the following patch using the supplied enrol.php seen here...

http://tracker.moodle.org/browse/MDL-14553

As far as I can tell the fields have been mapped correctly, as mentioned before the error logs do sometimes show the course ID. However Im not using a role field, the default role is set to student.

Many thanks, Im really banging my head against the wall now, I just can seem to work it out!


In reply to Dale Davies

Re: External DB enrol problems

by Dale Davies -
Just in case you need any more information, when a user logs in and external db plugin kick in, the following is added to the role_assignments part of the database.

The user ID being that of the user who logged in. However the context ID is incorrect.

ID
15181
ROLEID
5
CONTEXTID
6704
USERID
2840
HIDDEN
0
TIMESTART
0
TIMEEND
0
TMODIFIED
1220861137
MODIFIERID
2840
ENROL
database
SORTORDER
0

Has anyone experienced anything like this before?

Sorry to keep posting so often.
In reply to Dale Davies

Re: External DB enrol problems

by Dale Davies -
Well I have to say I never managed to work out why I was getting such weird results.

Somehow over the weekend the system seems to have "fixed itself", I suspect I was getting confused somewhere!
In reply to Dale Davies

Re: External DB enrol problems

by Armandt Slabbert -
Hi there, I'm a developer and new to Moodle. I've search for days now to find a solution like you just mentioned above. Could you please help me on how to add a user directly into the Moodle db and assigning them to a already created course. The scenario is like this. My client has a separate website where he advertises his courses. He also has a Moodle account/website with his current courses and students. Now when people goes to his separate website, they can select a course and register. I then have to take this user through a payment process and then manully insert them into my client's Moodle site and manually enroll them to this spesific course. Could you please help me with this. I got the part working where I need to insert the user into the Moodle db, but the enrollemnt part is unfimiliar to me. Thank you!!