I tried to have a a look at the database but unable to find a solution " For a given course id which all users have enrolled".
I understand it is somewhat related to table mdl_role_assignments but in that we have content not course id.
Please help me.
use this method.Available in Moodle 1.9.1 +
What should now be used in place of get_course_students()?
I want to know which tables have that info , How can i get the info using sql query.
Actually i am implementing a reminder module via database triggers so want to get the info via tables.
Thanks & Regards
A course will have a context. Users are assigned roles (such as student) within that context through role_assignments.
this is the query you need(if you just want the student use the roleid=5):
SELECT c.id AS courseid, c.fullname, u.firstname, u.lastname
FROM mdl_role_assignments ra, mdl_user u, mdl_course c, mdl_context cxt
WHERE ra.userid = u.id
AND ra.contextid = cxt.id
AND cxt.contextlevel =50
AND cxt.instanceid = c.id
AND c.id ='your course id'
AND roleid =5
Brilliant! Works so much better than my SQL; mine included classes the student had been in before, but are not currently in.
but when a user assigned globally meaning assign roles in system (Users->Permission->Assign system roles) then how to get those users by query?. Can you please give me the hints/or that query?