I working on send email when user manually enrolled to course.,by now i can send a email when user enroll to the system what i want to know is send enrollment expire date with the email,so if i can get from database that will work for me..,(any other method which can get this insie enroll unction also fine)
this is where i try to pass this parameters
public function enrol_user(stdClass $instance, $userid, $roleid = NULL, $timestart = 0, $timeend = 0, $status = NULL, $recovergrades = NULL) {
global $DB;
$alreadyenroled = $DB->record_exists('user_enrolments', array('enrolid' => $instance->id, 'userid' => $userid));
parent::enrol_user($instance, $userid, $roleid, $timestart, $timeend, $status, $recovergrades);
if (!$alreadyenroled && $instance->customint4) {
// Don't email immediately - give the admin a chance to remove users
// who were added by mistake
$this->queue_welcome_message($instance->id, $userid,$timestart,$timeend);
}
}
protected function queue_welcome_message($instanceid, $userid,$timestart,$timeend) {
global $DB;
if ($DB->record_exists('enrol_manual_email', array('instanceid' => $instanceid,
'userid' => $userid,'ts' => $timestart,'te' => $timeend))) {
return;
}
$ins = new stdClass();
$ins->instanceid = $instanceid;
$ins->userid = $userid;
////edit lasitha
$ins->ts = $timestart;
$ins->te = $timeend;
$DB->insert_record('enrol_manual_email', $ins);
}