add user with student role directly to database

add user with student role directly to database

by Petr Bezruc -
Number of replies: 0
Hi there,

I am enrolling users to courses directly in database (mdl_user_enrolments). But I need all users to have student role for each course, where are they enrolled. Can You help me, how to do it?

I have two ideas:
1) Directly in mysql, but I don't know the right tables. Where is connection "user, course, role"?
2) Set up defaultuserroleid as student. But this is not allowed by moodle. Where in code I can enable defaultuserroleid changing?

Regards,
Petr Bezruc
Average of ratings: -