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.
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.
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,
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.
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
Can you try without this modifications ?
For us, it works fine.
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.
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,
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!
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,