## Enrolment: Invitation

enrol_invitation
Maintained by Jérôme Mouneyrac
Send personal course invitation to some users by email.
2k
161
1

# Invitation Enrolment Moodle Plugin

## Maintenance

This is a none-core contributed plugin. You are welcome to do Pull Request on Github, to report issues, however no support is guaranteed.

## Features

With this enrolment plugin, teacher will be able to send personal invitation to some users by email. Each email contains a link with an invitation token with unique usage. When the user clicks on the link, (s)he needs to login/create an account, then (s)he is automatically enrolled into the course. (S)he is assigned a default role. The default role can be changed in the enrolment instance config page.

Only a limited number of invitations can be sent per course/day. However you can change the limitation. Moreover used invitations are not count.

## Installation

1. Add the plugin into /enrol folder.
2. Enable the enrolment plugin and set it up. It is quite similar to other enrolment plugins.

### Sets

This plugin is part of set Seeking new maintainer.

### Contributors

• Fri, Aug 2, 2013, 2:57 PM
Hi Carina, I only created this plugin to manage a very short number of participants so I didn't build any file import feature.
• Tue, Oct 15, 2013, 11:41 AM
• Thu, Feb 20, 2014, 3:43 PM
Is there any chance this may be updated to go with 2.6?

-Derek
• Mon, Mar 10, 2014, 10:25 PM
Hello, I've installed this module, and there's a bug related to the number of invitations that a user can send for a day.
The problem is in the function leftinvitationfortoday(), the query to get the number of invitations sent does not take into account the specific course you are looking for, so if you have sent 4 invitations for the course 1, and the course 2 allows you to send only 5 invitations, the number of available invitations for the course 2 today is only one. It could be fixed adding a new clause:
//$sentinvitations =$DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 ', array($onedayearlier));$sentinvitations = $DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 AND courseid = ?', array($onedayearlier,$courseid)); • Mon, Mar 10, 2014, 10:26 PM Hello, I've installed this module, and there's a bug related to the number of invitations that a user can send for a day. The problem is in the function leftinvitationfortoday(), the query to get the number of invitations sent does not take into account the specific course you are looking for, so if you have sent 4 invitations for the course 1, and the course 2 allows you to send only 5 invitations, the number of available invitations for the course 2 today is only one. It could be fixed adding a new clause: //$sentinvitations = $DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 ', array($onedayearlier));
$sentinvitations =$DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 AND courseid = ?', array($onedayearlier,$courseid));
• Mon, Mar 10, 2014, 10:26 PM
Hello, I've installed this module, and there's a bug related to the number of invitations that a user can send for a day.
The problem is in the function leftinvitationfortoday(), the query to get the number of invitations sent does not take into account the specific course you are looking for, so if you have sent 4 invitations for the course 1, and the course 2 allows you to send only 5 invitations, the number of available invitations for the course 2 today is only one. It could be fixed adding a new clause:
//$sentinvitations =$DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 ', array($onedayearlier));$sentinvitations = $DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 AND courseid = ?', array($onedayearlier,$courseid)); • Mon, Mar 10, 2014, 10:27 PM Hello, I've installed this module, and there's a bug related to the number of invitations that a user can send for a day. The problem is in the function leftinvitationfortoday(), the query to get the number of invitations sent does not take into account the specific course you are looking for, so if you have sent 4 invitations for the course 1, and the course 2 allows you to send only 5 invitations, the number of available invitations for the course 2 today is only one. It could be fixed adding a new clause: //$sentinvitations = $DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 ', array($onedayearlier));
$sentinvitations =$DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 AND courseid = ?', array($onedayearlier,$courseid));
• Mon, Mar 10, 2014, 10:27 PM
Hello, I've installed this module, and there's a bug related to the number of invitations that a user can send for a day.
The problem is in the function leftinvitationfortoday(), the query to get the number of invitations sent does not take into account the specific course you are looking for, so if you have sent 4 invitations for the course 1, and the course 2 allows you to send only 5 invitations, the number of available invitations for the course 2 today is only one. It could be fixed adding a new clause:
//$sentinvitations =$DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 ', array($onedayearlier));$sentinvitations = $DB->get_records_select('enrol_invitation', 'timesent > ? AND tokenused = 0 AND courseid = ?', array($onedayearlier,$courseid)); • Wed, Apr 16, 2014, 9:19 PM Is there going to be a 2.6 release? It doesn't send the invites • Wed, Apr 23, 2014, 11:11 AM @Chris, I've just read the comment from Jerome, and he says, 5 March 2013: "Try to not comment too much here about bugs, it's not that it's not good but I'm going everyday on Github, there is more chance that I'll see an issue report on github than a comment here" He is probably not watching the notifications from here. Maybe a PM will work, or a message on GITHUB with a bug report . . . -Derek • Thu, Jun 19, 2014, 3:23 PM Is there any plan to release on Moodle 2.7+ (Build: 20140522) ... Also can be use CSV to import emails • Sun, Aug 10, 2014, 5:52 AM First of all, BIG THANKS to Jérôme Mouneyrac for a wonderful plugin that saves my time!!! I'm enrolling my students via email invitations. Second, to Carina Martinez. I developed a small script, so a teacher can copy and paste the entire list of the students' emails to a specially designed window. Then you click on a button under this text window and the script populates all emails in the separate text strings designed by Jérôme Mouneyrac. Here is the script that you need to insert into invitation.php file (before "echo html_writer::tag('div', get_string('invitationpagehelp', 'enrol_invitation',$invitationleft), array('class' => 'invitationpagehelp'));" and after the line "if ($invitationleft > 0) {") //Eugene edit: add echo ' ## Paste a column of the class participants\' emails from Excel here: /enter one email address (and nothing else!) per line always followed by Enter/ onclick="if(document.getElementById(\'emailist\').value.split(\'\n\').length-1>',$invitationleft,')
{alert(\'Too many emails! Reduce please to ',$invitationleft,'.\');} else {'; for ($i = 1; $i <=$invitationleft; $i += 1) { echo 'if (document.getElementById(\'emailist\').value.split(\'\n\').length>',$i-1,')
{document.getElementById(\'id_email',$i,'\').value=document.getElementById(\'emailist\').value.split(\'\n\')[',$i-1,'];}';
}

echo '}
"
>

////Eugene edit: end

Third, to Japheth Leung. My investigation shows that the reason of why the plugin stopped working after Moodle2.5.1 is because they change the function "email_to_user()". My successful way around of this problem is to replace the new script in Moodle2.7.1 of the mail_to_user() function with the old email_to_user() function that I took from Moodle2.5.1. The script defining the email_to_user() function is listed in the moodle/lib/moodlelib.php file -- just search for the text "function email_to_user". The plugin works fine with this roundabout and so far I don't see negative consequences of my change.
• Mon, Aug 11, 2014, 3:48 AM
I took liberty and compiled an edited version of the Invitation Enrollment plugin that runs on Moodle2.6, Moodle2.7, and Moodle2.7.1. I also added a multiple email window. You can download the edited plugin from here: http://ematusov.soe.udel.edu/enrol_invitation_moodle22_2011100303_edited_by_Eugene_20140810.zip Enjoy, Eugene
• Thu, Nov 6, 2014, 1:40 AM
Dear Eugene Matusov,