Adding User Enrolment Search Variables Moodle 3.5

Adding User Enrolment Search Variables Moodle 3.5

by Amir Mustafa -
Number of replies: 1

Hello Developers,

I have been referencing this old article for extending search by other columns.

This was for old moodle versions and not helping (1.8)

https://moodle.org/mod/forum/discuss.php?d=40961

Please guide me.

Thank you for your help in advance smile

Average of ratings: Useful (1)
In reply to Amir Mustafa

Re: Adding User Enrolment Search Variables Moodle 3.5

by Amir Mustafa -
Hello Friends,


I fixed my own issue smile smile 

If anyone facing similar issue in the future you can fix this by going to the page

Page - project/enroll/locallib.php

The query is split into two functions:

1.  get_potential_users() - query is written - line 453 (approx)

// added LEFT JOIN to create link between registration number - 16.01.2019
$sql = " FROM {user} u
LEFT JOIN {user_enrolments} ue ON (ue.userid = u.id AND ue.enrolid = :enrolid)
LEFT JOIN {user_info_data} uid ON (uid.userid = u.id)
WHERE $wherecondition AND ue.id IS NULL
";

2. get_basic_search_conditions - where search where condition is added more (in my case I have added also search by registration number)

// added the second where clause
$conditions[] = $DB->sql_fullname('u.firstname', 'u.lastname');
$conditions[] = 'uid.data'; // added for filtering by registration number - 16.01.2019

I have attached the locallib.php page as well for better understanding
Average of ratings: Useful (1)