External Database Plugin Problem

External Database Plugin Problem

by Clark Jeria -
Number of replies: 0

I'm stuck here with this plugin, hope you can help me guys. I hope you guys doesnt focus on the "Why are you doing that!" because we need to do the following features for especific requeriments smile.


So, after I add a new row on my external database, I create the user (user_create_user()) and execute the sync_user_enrolments($user) (using Moodle API).


But for some strange reason when the sync_user_enrolments functions go to the external database (executing the following query: "SELECT * FROM EXTERNAL_DATABASE WHERE USERNAME = testinguser") it return an EOF (empty set)... and I'm like "What the hell?" because if I run the same query (copy/paste) on my external database it returns the required row.


Here is the freaky part: It only happen with the new users (when I call the sync_user_enrolments($user) with an existing user it works perfectly, even if i just add the row to my external database). And like that wasnt enough... if I create the user... and wait like 10 sec before run the sync_user_enrolments... it works :O...


Seriously... i'm really stuck... because what i see is that the sync_user_enrolments just do a SELECT * from my external database.. so.. why it returns an empty set with a new fresh user..... And what happens in those 10 secs... moodle runs a user_sync system or something?


I really try to debug it.. but after the query returns an EOF i cant go further... sad


Greetings,

Clark



Average of ratings: -