User enrolment tables?

User enrolment tables?

by Amal k -
Number of replies: 3

Hi,


When user is enrolled into a particular course. which tables are updated?. I want to find out course_id corresponding to user_id ? . 

Average of ratings: -
In reply to Amal k

Re: User enrolment tables?

by Miri Hefetz -

The tables to query are mdl_user_enrolments  and mdl_enrol

 

SELECT ue.id, ue.userid, e.courseid
 FROM {user_enrolments} ue JOIN {enrol} e ON ( ue.enrolid = e.id)
 AND userid = ?

In reply to Amal k

Re: User enrolment tables?

by Marios Theo -

Another thing that you can use to get these data is Moodle  API's (when you are outside moodle).


For your request you can get what you want with 'core_enrol_get_users_courses'