Local Plugin - Email Reminders for Calendar Events

Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -
Number of replies: 34

Hi All,

I am going to develop a local plugin to achieve an automated reminder system for Moodle calendar under my GSoC project.

I would like to propose major milestones that I am going to cover from my project.

  • Sending reminder messages for events will be automated using Moodle cron operations.
  • * For each event there can be several reminders based only from days. (Not supported for setting reminders based on hours or minutes)
  • No specific message outputs are being targetted. That is user/admin is responsible of recieving messages from any output as he/she desired. (Such as popups, jabbers, sms etc.)
  • User must have appropiate capabilities to recieve those reminder messages.
  • * An admin setting page will be provided to customize the reminders plugin. It contains enabling/disabling whole plugin and setting up number of reminders should be established for each event (Such as X days before). Currently this is fixed and providing only 7 days, 5 days, 3 days and 1 day reminders before any event.
  • Simple message format will be used. (Trying to get abstract from Google calendar event reminder format) Expecting to add direct links to the event within the message.

Challenges:

  • Performance issues (Full testing is required)
  • Storage issues (whether history of sent reminders should keep in database or not)
  • Providing individual user customizations for reminders. Currently only way to disable notification message for a specific user would be to remove the capability associate with him/her.
  • * Identifying when calendar events are being added or removed. Currently Moodle lacks an event to indentify adding events to calendar.

[* - Need ideas and feedback for correctness and improvements]

So, your valuable ideas/feedback are welcome and open to discuss about this plugin. This will surely be completed on or before August of this year.

-Regards

Average of ratings: Useful (1)
In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Patrick Pollet -

Hello,

   Surprinsingly, Moodle's calendar does not use the events API (http://docs.moodle.org/dev/Events_API ) to notify that a calendar event has been addd, removed, modified ... but an hook mechanism with functions to call described in global $CFG .

see code in calendar/lib.php (Moodle 2.2) given below :

/**
* Attempts to call the hook for the specified action should a calendar type
* by set $CFG->calendar, and the appopriate function defined
*
* @static
* @staticvar bool $extcalendarinc Used to track the inclusion of the calendar lib
* @param string $action One of `update_event`, `add_event`, `delete_event`, `show_event`, `hide_event`
* @param array $args The args to pass to the hook, usually the event is the first element
* @return bool
*/
public static function calendar_event_hook($action, array $args) {
global $CFG;
static $extcalendarinc;
if ($extcalendarinc === null) {
if (!empty($CFG->calendar) && file_exists($CFG->dirroot .'/calendar/'. $CFG->calendar .'/lib.php')) {
include_once($CFG->dirroot .'/calendar/'. $CFG->calendar .'/lib.php');
$extcalendarinc = true;
} else {
$extcalendarinc = false;
}
}
if($extcalendarinc === false) {
return false;
}
$hook = $CFG->calendar .'_'.$action;
if (function_exists($hook)) {
call_user_func_array($hook, $args);
return true;
}
return false;
}

So I guess that if you add the proper functions in a script named lib.php located in a subdirectory of calendar/ directory and declare it in config.php file, you should be able to trap one of the following action :  `update_event`, `add_event`, `delete_event`, `show_event`, `hide_event`... something like

$CFG->calendar = 'mycalendarshooks'; //name of the subdirectory in calendar/

....

Of course you could also write a tracker request to ask for calendar to use standard event APi, but that will likely take more time to be implemented.

Cheers. 

      

Average of ratings: Useful (1)
In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Geson Perry -

Hi Isuru, sounds great!

I would love if it will be possible to make a calendar event for a group and that all members of that group will recieve reminders for this calendar event via mail (7, 5, 3 and 1 day ahead of the event). (High importance)

Maybe the  admin could recieve an internal log message that an event reminder was sent. (low importance)

A log could be kept in the database regarding sent reminders: to whom (what group / user), at what time and for what calendar date / event. If one needs to present when a certain reminder was sent, that could be a nice to have feature. (low importance)

Average of ratings: Useful (1)
In reply to Geson Perry

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi,

Thanks for your valuable ideas.

Your first idea will be a main focus of mine as well. We can identify a set of users that are relevant to a specific event by using courseid, groupid and userid attributes in Moodle event table. But selecting a custom user group for an event will have to think how to do it.

My feeling about second one is that it may cause additional message problem to admin. But if admin thinks it is required, a separate setting can be provided.

I think third one is important as well in case of something wrong happened to trace out what it is. The challenge is log might be rapidly filled even with small set of reminders were sent.  If the storage issue is not a matter, then it can implement. Or a admin setting can be provided to enable this tracing or to not.

-Regards

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Julian Ridden -

Some random ideas (translated as "my 2 cents worth")

  • would be nice for the student to have a setting to set a "default reminder" for all items in that calendar. It would allow them to set default delivery method and reminder time
  • students should be able to click on any event in their calndar (generated by themselves, teacher created or activity created) and set reminders. Muktiple reminders if need be.
  • I "personally" doent believe this is a setting that should be set by teachers on behalf of their students. Reminders are a very personal thing.
  • Admin will need to be able to restrict delivery methodologies. Obvious thought is permissions, but I think this may be too complex. A new setting in the message outputs perhaps.

Just some points to start discussion. Feel free to disagree or debate smile

Average of ratings: Useful (1)
In reply to Julian Ridden

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi Julian,

Thanks for your ideas.  

I will consider each of them one by one in single bullet point.

  • Delivery method is depend on how the user has configured his/her message providers by him/herself. Definitly my local plugin will provide a new message provider to every user having necessary capability. But allowing setup of reminder times is a problem I am still facing. Actually I couldn't find a way to add a user specific settings page via a local plugin. 
  • As a GSoC project they won't allow to edit the core unless it is highly important and necessary. I guess this has to change the calendar event.php or event_form.php file, so unfortunately I am afraid this can be done even you and I like it.
  • Yes. me too. reminders are personal thing, but as the first step my goal is to develop general reminder system without specific user customizations. But If I had enough time (I think I may have) I will try to discuss with mentor and develop it as well.
  • Actually at the moment I am still thinking/designing how to achive personal disabling of reminders by admin on specific users. I also agree that it should be a more convieneance way than capabilities.
In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Jason Neely -

A comment on bullet three (from Julian's inital post):

While I agree that reminders are a personal thing, I also will throw out there that we are using Moodle for a research project. We want to have reminders sent out on a regular basis to complete a log they are keeping. We wouldn't want participants to be able to turn the reminder off (which it sounds like wouldn't be allowed with this first version at least).

Isuru, I look forward to seeing your final product.

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

As a start, I would like students to be able to tell Moodle how many hours before a due date of an item in the calendar they should be sent a reminder.  In a way, this is like "upcoming events" except the student configures it.  I think it would be nice for students to be able to give a separate email address for this if they wish.  For example, a student might want to put in their text message email address.  A more flexible text box, such as:

Email addresses:  abc@123.com, yyy@aaa.edu, 1234567890@myphone.com

would be helpful.  I am purposely showing more than one email address.

 

In reply to Rick Jerz

Re: Local Plugin - Email Reminders for Calendar Events

by Philipp Pavelka -

I love the idea where you can add custom users oder user groups to an event. 

I can imagine to use it for shift planning or specific teachers can reminded about changes regarding their class.  

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi All,

At writing moment I am very close to create a prototype version of this reminder local plugin. Within next few weeks I would be able to finalize it and release a prototype.

Since I do not have access to a considerably large Moodle server, I would appreciate if anyone is willing to test this local plugin and give feedback about bugs and enhancements.

You can find my progress in CONTRIB-3647 and developer documentation in here.

Also plugin developer repository can be found in https://github.com/isuru89/moodle-reminders-for-calendar-events.

-Regards
Isuru 

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Julian Ridden -

Thanks for all the hard work to date.

Have just cloned the GIT repo to my test install. Will post any bugs I find to the tracker.

JR

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi All,

I would like to announce that I could release the first version of my reminders plugin to the Moodle plugin repository. I have attached a screenshots about my plugin (sample e-mail reminder).

You can always download it from here http://moodle.org/plugins/view.php?plugin=local_reminders

Also if you want to know any recent changes or like to improve it by yourself you are welcome to fork and use my reminders github project in here https://github.com/isuru89/moodle-reminders-for-calendar-events.

If any bugs/issues have been found by you, report them here http://tracker.moodle.org/browse/CONTRIB-3647.

Good luck!

-Regards
Isuru

Attachment sample reminder msg.png
In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by John Andrewartha -

A couple of quick questions.

Does the plugin take into account TZ of student?

Will this work on Moodle 2.3.1?

What a brilliant plugin. Thank you.

John

In reply to John Andrewartha

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi John,

I have no idea what mean by 'TZ of student '? smile

This plugin is tested in both Moodle 2.2 and 2.3 and it is working on them! Not much sure about Moodle 2.0 or 2.1, but have to check.

-Regards
Isuru

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by John Andrewartha -

Hi Isuru,

TZ = Time Zones.  Does the plugin make the time zone adjustment?

I have students across 5 time zones.

John

In reply to John Andrewartha

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi John,

Plugin doesn't do any timezone adjustments. All the times in a reminder e-mail message is shown in server time, not adjusted to user's time zone.

I talked about this with my mentor and he said users might be confused if timezone adjustment is set on messages . Anyway this might be a wishlist for the future.

-Regards
Isuru

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Flotter Totte -
Picture of Plugin developers

Great! Congratulations and Thanks!

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by robert esco -
Hello how are you

I'm trying to implement this plugin in Moodle 2.6.3 but does not work, but the installation was performed successful, panel settings and does not send any email reminder, to do some extra configuration with crontab or something?
regards.
In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Anju Menon -

Hello,

I am using the Moodle 2.2.3 version. The reminder plugin has been installed and the mails are also getting populated in the participants mail box regarding the test details. But apparently the participants are getting a same mail every 1 hour. I have made the setting for sending the reminders only on 7th, 3rd and 1st day prior to the quiz scheduled date.

How am I going to stop flooding the inbox by repeated sending of the same mails and restrict it to just 3 mails for each quiz.

Thanking in advance.

Regards

Anju Menon

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi All,

A new version of reminder plugin has been released and you can download it from here.

Change log:

  • fixed bug of repeatedly sending reminders for same event.
  • removed 'Only hidden events from calendar' option from the settings page.
  • removed unused constants from the plugin.
  • improved cron trace of the plugin for ignored events.

If you have any ideas/improvements/bugs, feel free to let me know via CONTRIB-3647.

-Regards
Isuru

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Rob Bright -

Hi,

First, let me say that this is a fantastic idea for a much needed piece of functionality; however, I can't get this to work on my moodle 2.3.1 installation.

I have installed it as set out, but no reminders are sent out to anyone.

What am I doing wrong?

In reply to Rob Bright

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi Rob,

I would like to look at the moodle trace produced by a cron cycle (which includes a cron cycle from reminders plugin). It would be grateful if you can provide that trace to help understanding what's wrong with the plugin.

-Regards
Isuru

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Paul Nijbakker -

Hi Isuru,

Thanks for this plugin. It meets an exisiting need and I would like to encourage you to finish it. I can confirm it works in 2.3. We hope it will also work in 2.4.

Please, find attached a Finnish lang file for the plugin.

Rgrds,
Paul.

In reply to Isuru Madushanka Weerarathna

Error with plugin on Moodle 2.2

by Kent Villard -

When the cron job runs I see this error in our logs (and apparently email reminders are not being sent)

----
Warning: Missing argument 6 for get_logs(), called in /var/www/mymoodledir/local/remdiners/lib.php on line 70 and defined in /var/www/mymoodledir/lib/datalib.php on line 1835
(Moodle 2.2+ on Linux)

Has anyone seen this or have any suggestions?

In reply to Kent Villard

Re: Error with plugin on Moodle 2.2

by Isuru Madushanka Weerarathna -

Hi Kent,

Actually I noticed this warning (by-the-way, this is not an error smile ). And this must not cause to fail sending reminder messages. If you can read the cron log contents after this warning, you will be able to identify the issue of not being able to send reminder messages.

In future versions, I will remove this warning.

Thanks

In reply to Isuru Madushanka Weerarathna

Re: Error with plugin on Moodle 2.2

by kishore kommireddy -

Hi Isuru,


Recently i was started to using moodle,first of all i have to say congrats for great effort on this.


I have seen this plugin day before yesterday and i was installed,and i fixed all the settings as well but how it will work (suppose i have to start new event on tomorrow and i fixed the setting as 1 day before sent a email to students.How it will work...?) and is there any function to start..! please do needful.

Thanks in advance......smile

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Jun Nakamura -

Hello, Isuru,

Thanks for your plugin, which works in 2.3.4 .

I translated its lang to Japanese.  Please, find the attached file.

I think japanese moodlers also expect your plugin.

 

Regards.

Nakamura.

 

 

 

Average of ratings: Useful (1)
In reply to Jun Nakamura

Re: Local Plugin - Email Reminders for Calendar Events

by Germán Valero -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Jun Nakamura (I translated its lang to Japanese.  Please, find the attached file):

Can you please contact the Japanese language pack maintainers listed at http://docs.moodle.org/24/en/Translation_credits#Japanese_.28ja.29 and send them the translation ?

Thanks,

Average of ratings: Useful (1)
In reply to Germán Valero

Re: Local Plugin - Email Reminders for Calendar Events

by Jun Nakamura -

Thank you!!

I contacted one of the Japanese pack maintainers, who had helped me at theJapanes Forum.

 

Thanks,

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Germán Valero -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Isuru,

I was translating (in http://lang.moodle.org/) the local remainder plugin into spanish for Mexico and I found what seems to be a typo in one original English language string:

2.2 [explainsiteheading,local_reminders] "Reminder settings for site events. These events are relavent to all the users in the site."

"relavent" should be "relevant" (I think, but I am not a native English speaker). Can you please check it?

Thanks in advance for your help smile

 

Average of ratings: Useful (1)
In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Isuru Madushanka Weerarathna -

Hi All,

Today I could release a plugin version for new Moodle 2.4. And any one interested can download it from here. https://moodle.org/plugins/view.php?plugin=local_reminders.

Change Log for v1.2:

+ now works in Moodle 2.4.*
+ fixed bug when sending reminders based on groups
+ group reminder message content has been made richer by including course and activity details.
+ added a setting to define the prefix for messages being sent, and
added another setting to define to show/hide group name in the group reminder message.
+ cron cycle interval for this plugin has been reduced from 1-hour to 15-minutes.

Really appreciate any issues related with this plugin and report them under CONTRIB-3647

I also have few ideas on my mind to develop this plugin into a better one and currently I am working on them. All your ideas are welcome to enhance this plugin.

-Thanks 

In reply to Isuru Madushanka Weerarathna

Re: Local Plugin - Email Reminders for Calendar Events

by Chris Buck -

Does the latest plugin code not work with moodle 2.8? I migrated to a new server (painful) to see if that would help the spamming of event reminders. It did not. I upgraded to moodle 2.8 and got the latest event reminder code (1.4) and it stopped working altogether.

Does email reminders version 1.4 not work with moodle 2.8? I'll stop trying to debug if that is the case.

In reply to Chris Buck

Re: Local Plugin - Email Reminders for Calendar Events

by sirisha g@ -

Hi Isuru,

I have installed the plugin in Moodle 2.8.6 version but I am not receiving any emails after creating an event. I have set the reminder to receive email 1 day before. And I even checked if anything went wrong with the time. 

Could you please help me what is going wrong/

Thanks

SIrisha

In reply to sirisha g@

Re: Local Plugin - Email Reminders for Calendar Events

by Peter Ward -

Hi Isuru,


Did you get the plugin working on moodle 2.8?


I have a clean install of moodle 2.7 with Event Reminder 1.4 and that works fine.

But on both a clean install of moodle 2.8 (and one that has progressively been upgraded from pre moodle 2.6) with Event Reminder 1.4.1 I can't get the reminders to be sent.

Let me see if I can gather any other info on this.

Cheers


Peter