Enrolment: Badge Enrolment

enrol_badgeenrol
Maintained by Picture of Matthias Berlin (Schwabe)Matthias Berlin (Schwabe)
With this enrolment plugin users can only enrol into a course when they have one or more required site badges.
261 sites
96 downloads
23 fans
Current versions available: 3

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

Sets

This plugin is part of set Badges.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2
Screenshot #3

Contributors

Picture of Matthias Berlin (Schwabe)
Matthias Berlin (Schwabe) (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of David Mudrák
    Tue, Nov 24, 2015, 4:48 PM

    Hi Matthias, and thanks for sharing this plugin with the Moodle community. While attempting to test the functionality, I encountered a problem on PostgreSQL and reported details into your tracker. Otherwise the code looks sane so I believe that once the PostgreSQL bug is fixed and a new corrected version is uploaded here, this can be approved. For now, I am marking this as needing more work. Thanks for your patience with the review and approval process.

  • Picture of David Mudrák
    Tue, Dec 1, 2015, 10:50 PM

    Thanks Matthias for fixing the issue promptly. You are cleared to land now, welcome to the Plugins directory!

  • Picture of Frank Leone
    Tue, Jan 5, 2016, 8:54 PM
    Looks like a great plugin, thanks! I would like to use this plugin in a context where users are a member of a group in each course. Is it possible to use group enrolment keys in combination with badge enrolment? Or is there another way to automatically assign a user to a specific group? Thanks a lot in advance!
  • Picture of Richard Wallace
    Wed, Mar 2, 2016, 3:31 PM
    Matthias, great plugin, I have installed on the latest moodle, it comes up in the course, but when I add a site wide badge and give that to students, then those students do not automatically appear enrolled in that course.

    I now know that the student themselves need to actually enter the course themselves to "self enrol".

    well done
  • Picture of Chester Folming
    Tue, May 31, 2016, 4:32 PM
    Hi Matthias
    Do you have plans to update this plugin for Moodle 3.0 and/or 3.1?
  • Picture of Markus Müller
    Thu, Jun 30, 2016, 7:10 PM
    Hey! This is exactly what I needed and I already installed the plugin. I've got a problem though. The restricted courses show now the Line "You need the badge XYZ to enrol in this course." - seems fine. BUT the "enrol me" button underneath is still active and the seemingly excluded user can STILL enrol.

    Any ideas...?
  • Picture of lebo sekele
    Mon, Aug 29, 2016, 3:30 PM
    Good day, I need help I cant get the plugin to work with my site badges. I need a student to be enrolled into a course after they get an average of 65% of all the activities in the first course. The course badge seems to work but the site badge isn't.

    May you please help been trying to solve this.

    Thanks,
  • Peter Jonker
    Fri, Sep 30, 2016, 8:59 PM
    Dear Matthias, we are having a problem adding the enrolment method resolving in an error which is also being reported in your github
    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
  • Picture of Rob Mills
    Sun, May 7, 2017, 5:42 PM
    This is potentially a very useful plugin. Its strange to me how few Moodle users have courses with no pre-requisites - its quite common on any training setup. I have found that if manual enrolments are also enabled on a course then this overrides badge enrolment. It seems the way it works is that one is automatically enrolled on a course as soon as the required badge is earned. Can somebody confirm this please.

    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.
  • Picture of Tobi Krösche
    Thu, Nov 2, 2017, 8:41 PM
    Does someone know, how to use this in the current moodle version ?

    Thanks
    Tobi
  • Picture of Terus E-learning
    Fri, Jan 19, 2018, 2:59 AM
    Got the wrong end of the stick with this one. I was expecting it to automatically enrol students based on badge enrolment.
    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";
    }
  • Picture of Matthias Berlin (Schwabe)
    Sun, Mar 18, 2018, 9:38 PM
    There is now an updated version of this plugin available for the latest versions of Moodle.
    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.
  • Peter Jonker
    Sun, Mar 18, 2018, 11:09 PM
    Matthias thanks very much for your work! Highly appreciated! Peter Jonker
  • Picture of Christine Sandy
    Wed, Jun 26, 2019, 12:36 PM
    Thank you very much for this plugin, it's very useful for my LMS.

    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.
Please login to post comments