Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Sazia Arif -
Number of replies: 9
Thank you Julien Boulen for your prompt reply.


Please share the functions you copied and the steps you have taken, that will be of great help to me.

 I am using Moodle 3.3.

Also can I customize the message in Email body.

In reply to Sazia Arif

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Julien Boulen -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

You can find our modifications on our github.

You can set different message for each methods. It's just a copy-paste from "self" enrol method.

Regards,


Average of ratings: Useful (1)
In reply to Julien Boulen

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Sazia Arif -

Thank you for your help Julien.

I am able to send email on Cohort Sync. I have below queries will you please help me out on this.

1) Changes made in enroll/manual/lib.php, where will it get displayed. As I made that changes but the enrollment email is not sent when I used Browse Cohort feature in enroll user popup.

2) If a Participant is added to the Cohort ,after Cohort Sync, how can I send enrollment notification email to newly added participants.

In reply to Sazia Arif

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Julien Boulen -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
1) It does for us. Do you have set a custom welcome message on your manual enrolments method before use enrol user popup?

2) It already sends a notification email. Doesn't it happen when you add a user in your cohort via site administration / users / cohorts?

In reply to Julien Boulen

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Sazia Arif -


1) Yes, I have followed steps mentioned in below link, to send email notification when selecting individual users in enrol popup. This works only in Individual enrol case not in Browse Cohort user case.

https://moodle.org/mod/forum/discuss.php?d=108292#p1285695

Steps:

Add below code in /enrol/manual/ajax.php before echo json_encode($outcome);

require_once($CFG->libdir.'/moodlelib.php');

$body = "You have been enrolled to course"." ".$course->fullname."<br/><br/>"."Please login to start your course."."<br/><br/>"."Thanks,"."<br/>Admin";

email_to_user($user,$USER,'Enrollment Notification','The text of the message',$body);


2) Yes an email notification is getting sent when a user is added in cohort via site administration / users / cohorts

In reply to Sazia Arif

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Julien Boulen -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Can you try without this modifications ?

For us, it works fine.


In reply to Julien Boulen

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Sazia Arif -

I tried commenting below line in enrol/manual/ajax.php , still its not working.

email_to_user($user,$USER,'Enrollment Notification','The text of the message',$body);


Can you please share a snapshot of the page where this modification will be visible.

In reply to Sazia Arif

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Julien Boulen -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

When you use enrol popup, if notifications are sent with "browse users" option, there is no reason that it doesn't work with "browse cohorts" because Moodle enrols each users from selected cohort with "manual enrolments" method.

So, in both case, it's the same part of source code that is executed.

The only visible modified thing is here :



But if you are already notified for manual enrolments, I think your settings are good.

Maybe you have others modifications that run in conflict with our changes. But if you have these 4 lines, messages must be sent.

Regards,

In reply to Julien Boulen

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by marisol castro -

Hello Julien!

I have looked at your code on git hub.  I am new to this and code development.  When you say copy/paste where in the enrol\cohort\lib.php file do you paste your code?  Did you put it at the end or in a specific location within the file?  Any assistance you can provide would be truly appreciated.  Thanks! 

In reply to marisol castro

Re: Sending Enrollment Email to participants on using Enrollment Method Cohort Sync

by Julien Boulen -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Marisol,

You can download and replace your files by this files:

But be careful ! This modifications are only tested on Moodle 3.3. So you must use Moodle 3.3

If you use another version, it may doesn't work or even broke your enrolment pages.

If you are interested by this feature, maybe you should add a comment and vote for this issue.

Regards,