Messaging: Automatic e-mail to warn students of the days remaining on their course enrolment (:

Messaging: Automatic e-mail to warn students of the days remaining on their course enrolment (:

David Hoeffel發表於
Number of replies: 2

Hello,

I've been working on this since several days now. What I am planning to do, is add a functionnality that sends out emails to students 30, 20 and 2 days before their enrolement in a course ends.

This aims at warning them, so they can planify their work better. I'm quite a novice in Moodle developpment so I'd be happy if you could give me your point of view on what i'm doing.

 ****************************

  • SQL request that gets, for each course enrolment : student id, course name and timestamp remaining before enrolment end. This query fills a table that contains all important info for emailing.

SELECT u.id as uid,
c.fullname as nom_cours,
(IF(ue.timeend!=0,ue.timeend-UNIX_TIMESTAMP(),0)) as tps_restant

FROM mdl_course c,
mdl_enrol e,
mdl_user_enrolments ue,
mdl_user u

WHERE u.id=ue.userid
AND c.id=e.courseid
AND e.id=ue.enrolid

****************************

  • PHP code that converts timestamp into days. (or seconds in days actually). Thats the type of thing I am doing :

ceil(timestamp/86400);

****************************

  • I'd like to make a CRON file (if that's the only solution) to check, every day in my table how many days are remaining for each enrolment, en send out emails if the remaining time of a student enrolement in a course is equal to 30, 20 or 2 days.

****************************

 

But I have no clue of how to make a CRON file... I've read some things like "it has to be deployed on the server via a terminal" or "Moodle has cran files that are used to execute other cron files" but I'm not sure where to start. If you've got any ideas, I'd be happy to hear them =D

Thanks a lot !

 

Cheers,

David



 

 

****************************

評比平均分數: -
In reply to David Hoeffel

Re: Messaging: Automatic e-mail to warn students of the days remaining on their course enrolment (:

Helen Foster發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片 Translators的相片

Hi David,

There is an issue report for this in the Moodle Tracker - MDL-28980. I suggest you add a comment there about your suggested fix. (You'll need to create a tracker account and login in order to add a comment.)

In reply to Helen Foster

Re: Messaging: Automatic e-mail to warn students of the days remaining on their course enrolment (:

David Hoeffel發表於

Hi Helen and thanks for your quick answer. I'll see what I can do.