Easy Enrolments Plugin - SQL to pull Pass Code (using configurable reports plugin)

Easy Enrolments Plugin - SQL to pull Pass Code (using configurable reports plugin)

by K D -
Number of replies: 3

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


Average of ratings: -
In reply to K D

Re: Easy Enrolments Plugin - SQL to pull Pass Code (using configurable reports plugin)

by Randy Thornton -
Picture of Documentation writers
You need to know what the value is for this particular plugin in the en.enrol field. Standard ones are those such as 'manual' and 'self'. Look at that table to fined out what that is.

Then you need to then find in what column it stored the code. For example, the Self-enrolment method stores the enrolment key in the column called 'password'. This plugin may store it there or in perhaps one of the various custom values columns. You will have to take a look at that to find them.

This report by Séverin will help you with the logic, too. https://docs.moodle.org/400/en/ad-hoc_contributed_reports#Lists_.22Totally_Opened_Courses.22_.28visible.2C_opened_to_guests.2C_with_no_password.29
In reply to Randy Thornton

Re: Easy Enrolments Plugin - SQL to pull Pass Code (using configurable reports plugin)

by K D -
Hello Randy,

You genius thank you. I think I have been staring at it too long. That is right thinking. Thank you that is very much appreciated. I will have a look.

I love the reports on that page so will have a look, thank you again. Take care
In reply to K D

Re: Easy Enrolments Plugin - SQL to pull Pass Code (using configurable reports plugin)

by Randy Thornton -
Picture of Documentation writers
You are welcome. I think that code from Séverin will help you a lot to get your report working.