Moodle Plugins directory: Badge Enrolment | Moodle.org
Overview
With this enrolment plugin users can only enrol into a course when they have one or more required site badges.
Requirements
Moodle 2.9+ and badges enabled.
Installation
The zip-archive includes the same directory hierarchy as moodle.
So you only have to copy the files to the correspondent place.
Copy the folder badgeenrol to moodle/enrol/badgeenrol.
The langfiles normaly can be left into the folder moodle/enrol/badgeenrol/lang.
All languages should be encoded with utf8.
After it you have to run the admin-page of moodle (http://your-moodle-site/admin)
in your browser. You have to loged in as admin before.
The installation process will be displayed on the screen.
That's all.
Administration
You can manage the badge enrolment plugin by going to Site administration --> Plugins --> Enrolments --> Manage enrol plugins.
Version control
1.3 (2018072700)
- Added support for privacy API
1.2 (2018031700)
- added option for automatic enrolment - thanks to Dan Marsden
- some small fixes
1.1 (2015120300)
- Selected badges during installation of a badge enrolment instance will be saved now
1.0 (2015102400)
- first release
I now know that the student themselves need to actually enter the course themselves to "self enrol".
well done
Do you have plans to update this plugin for Moodle 3.0 and/or 3.1?
Any ideas...?
May you please help been trying to solve this.
Thanks,
Could you please let us know if you are able to work around this error. Our Moodle version is 2.7.8
https://github.com/m-schwabe/enrol_badgeenrol/issues/2
Debug info: SELECT id FROM {role} WHERE archetype = ?
[array (
0 => 'student',
)]
Error code: multiplerecordsfound
I have a requirement that a person only get enrolled on a course if their instructor enrols then AND they have completed another course. I can't seem to achieve this using this plugin.
Thanks
Tobi
I only had 30 minutes for this but I created a function which could use some refining (and perhaps it could cycle through the badges table instead of the entire users table) but in principle something like this could be enclosed in a public cron() function:
function dotheenrols(){
global $OUTPUT, $USER, $DB;
$all_users = $DB->get_records_sql('SELECT * FROM mdl_user');
foreach ($all_users as $r_user){
//set all user table variables
$user_id = $r_user->id;
if ($record = $DB->get_record('badge_issued', array('badgeid' => 3, 'userid' => $user_id))) {
//they have the badge
$context = context_course::instance(19);
$context2 = context_course::instance(29);
// What role to enrol as?
$studentroleid = $DB->get_field('role', 'id', array('shortname' => 'student'));
// Loop through the students.
if (!is_enrolled($context, $user_id)) {
// Not already enrolled so try enrolling them.
if (!enrol_try_internal_enrol(19, $user_id, $studentroleid, time())) {
// There's a problem.
throw new moodle_exception('unabletoenrolerrormessage', 'langsourcefile');
}
}
if (!is_enrolled($context2, $user_id)) {
// Not already enrolled so try enrolling them.
if (!enrol_try_internal_enrol(29, $user_id, $studentroleid, time())) {
// There's a problem.
throw new moodle_exception('unabletoenrolerrormessage', 'langsourcefile');
}
}
}
}
echo"done the enrols";
}
Sorry for waiting so long, but there wasn´t much time in the last two years. I will try to update my plugins consistently from now on.
There is also now an option for automatic enrolment.
@Peter Jonker: This issue is now fixed.
Though I noticed that when students already earned badge before I set up the badge enrolment, they can't enroll in the course automatically.
So I need to evoke the badge first and give them the badge again manually. Can you please tell me how to fix this? I would like all of my old students to enroll automatically with badge enrolment.
Do you plan to make the version compatible with moodle 3.11 or 4.0?
Ricardo
(Kannst gerne in Deutsch antworten)
Besten Dank
Hello Matthias, as far as I've seen course participants need to have all badges to enter the course. I have a Moodle course in 3 languages, thus I have 3 different badges for one and the same thing (I related them as suggested by Moodle). Now I would like to set it up in a way that course participants only need to have one of them to enter the course.
sorry for replying so late.
You can add multiple instances of the badge enrolment to your course and configure diffenrent badges for each badge enrolment instance. Your users will only have to pass the requirements for one of these instances.
Hope it helps.
Greetings!