Skip to content

Instantly share code, notes, and snippets.

@xyulex
Created July 14, 2017 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyulex/0e60f50a5e5f9b3fae9f2e44272b1dc6 to your computer and use it in GitHub Desktop.
Save xyulex/0e60f50a5e5f9b3fae9f2e44272b1dc6 to your computer and use it in GitHub Desktop.
MOODLE: Enrol user as a student
$plugin_instance = $DB->get_record("enrol", array('courseid' => $courseid, 'enrol'=>'manual'));
$plugin = enrol_get_plugin('manual');
$roleid = $DB->get_field('role', 'id', array('shortname' => 'student'));
$plugin->enrol_user($plugin_instance, $userid, $roleid);
@xyulex
Copy link
Author

xyulex commented Jul 14, 2017

Matricula un usuario con el rol de estudiante en un curso determinado.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment