Reposted from Enrolment Thread (Moodle in English: Easy Enrolments Plugin - SQL to pull Pass Code (using configurable reports plugin)) Sorry this would be better placed here. Hope that is ok.
Dear All,
I hope everyone is keeping well. I am desperately trying to find the Table/field that would allow me to pull in my SQL course report with the code needed to enter the course using Easy Enrolments.
Report method -Configurable reports plugin SQL (tables I have tried Enrol table / enrol - Moodle LMS 3.9 Database schema / Zoola Analytics)
I am after the Enrolment Method - Easy Enrolment Code
Current SQL report (sorry not very tidy as a little rusty but might help people if it is ok) ( constructed using the popular ad-hoc contributed reports - MoodleDocs)
Select cat.id as categoryid, cat.name as categoryname, c.id as courseid, c.fullname as FullCourseName,
c.shortname as ShortCourseName, c.summary as CourseSummary, c.format as CourseFormat,
c.startdate as CourseStartDate, c.enddate as CourseEndDate, c.timecreated as CourseCreatedDate, c.timemodified as CourseLastModified,
concat('<a target="_print" href="%%WWWROOT%%/course/view.php?id=',c.id,'">',c.fullname,'</a>') as courselink,
e.enrol AS enrolmethod, e.password as enrolcode
From prefix_course AS c
JOIN prefix_course_categories as cat on cat.id = c.category
JOIN prefix_enrol AS e ON e.id = c.id
I look forward to hearing your thoughts and a big thank you in advance.
Many thanks,
K