Using this, for example:
FROM mdl_role_assignments rs
INNER JOIN mdl_user u
ON u.id = rs.userid
INNER JOIN mdl_context e
ON rs.contextid = e.id
WHERE e.contextlevel = 50
AND rs.roleid = 5
AND e.instanceid = 26
Where "26" is the course ID that I want. Very well. I alredy know the number using this query.
But how the student will know his own number?
I had the idea of write a PHP script in somewhere in Moodle, when the student logs in, the number is printed in a block or something like that. But I don't have idea where to put the PHP piece of code and what piece of code would be! (I'm designer, not a developer, but I'm learning) =)
As a suggestion to Moodle developer team, I really would appreciate if Moodle has a built in resource that provides a registration number by default for the student.
Thanks and sorry by my english.
- best regards from Brazil!