My idea on my moodle I create unique username to identify the student by their year entrance. For example the username format is X0012001 , X0012002 the first 4 digit identify the entrance year that mean 2012 and the last 3 digit is the student unique ID. After long time I realize that the Moodle enroll search system identify the student by the NAME or EMAIL, so my idea now messy :))

I think it will be no problem for few number of student join the course , but if it hundred it will nightmare :))

So I open the assign.php file on moodle, doing dirty hack. The search process will be search the USERNAME instead of EMAIL.

On line 287 (admin/roles/assign.php)

Change the code to this one :

$selectsql = " AND ($FULLNAME $LIKE '%$searchtext%' OR username $LIKE '%$searchtext%') ";