Totara Learn Open Discussions

Creating a custom program notification message

 
? ?
Creating a custom program notification message
by ? ? - Monday, 30 September 2019, 7:45 AM
 

Hello,

I'm working on a development project with Totara to create a new program message template that triggers based on a trigger time of my choosing. I have found most of the relevant places in the core Totara files that will need to be edited in order to create a new message template, but I can't figure out where in the code the trigger time for a message is actually defined. For example, the Program Overdue message is set to trigger X days after the program is due, but where in the code is this value actually converted into a time that can be stored in the database and checked against to determine when to send out the message? 

Thanks for any help. (I'm working with Totara version 12.4.)

Nathan Lewis
Re: Creating a custom program notification message
by Nathan Lewis - Tuesday, 1 October 2019, 5:36 PM
Group Totara

Hi Sam.

Have a look at totara/program/classes/task/send_messages_task.php. When it runs, it calculates which things are due to be sent. An easy to read example is program_cron_programs_overdue, with sql "(pc.timedue + pm.triggertime) < :now".

Nathan

? ?
Re: Creating a custom program notification message
by ? ? - Thursday, 3 October 2019, 12:02 PM
 

Thanks, Nathan, that's very helpful!