pretty basic questions:
What is the PHP function to add a course for a user?
and also, what is the PHP function to delete a course for a user?
P.S. Please include any other PHP functions on this topic that you think might be useful for me dealing with courses and permissions and users.
In reply to dirty slit
Re: What are the PHP functions to add/remove a course for a user?
by Tim Hunt -
The way to answer this sort of question for your self is as follows:
1. How do you do this using the Moodle interface?
(Answer, you click on the Assign Roles link in the course admin block, then choose a role to assign.)
2. So, which PHP script is involved?
(Looking in the URL bar, we see that the assign roles UI is admin/roles/assign.php?roleid=5&contextid=..., that is http://cvs.moodle.org/moodle/admin/roles/assign.php?view=markup&pathrev=MOODLE_19_STABLE)
3. Looking at that code, which function does it call?
(Answer: somewhere under the // Process incoming role assignment comment, there is a call to role_assign.)
1. How do you do this using the Moodle interface?
(Answer, you click on the Assign Roles link in the course admin block, then choose a role to assign.)
2. So, which PHP script is involved?
(Looking in the URL bar, we see that the assign roles UI is admin/roles/assign.php?roleid=5&contextid=..., that is http://cvs.moodle.org/moodle/admin/roles/assign.php?view=markup&pathrev=MOODLE_19_STABLE)
3. Looking at that code, which function does it call?
(Answer: somewhere under the // Process incoming role assignment comment, there is a call to role_assign.)