nblgeoweb VIP
Total posts: 178
24 Sep 2014 16:13

I'm using Cobalt to make a simple system for managing one of our internal processes. I'd like to have users notified immediately of changes in the record but I have other sections where users only need to be notified daily at most. Is there a way to set the alerts schedule for a user to be different for different sections? If not, is there a way to set the cron job for creating alerts to only work with a single section rather than all sections?

One way to handle this would be to have a cron job that generates alerts for a specific section immediately regardless of user settings. I can run the cron frequently (maybe every 5 minutes). Then the alerts for other sections are not affected.

Do you have any suggestions how I could do this?

Last Modified: 25 Sep 2014


nblgeoweb VIP
Total posts: 178
25 Sep 2014 01:16

I did some experimenting and here's what I came up with...

I created a copy of com_cobalt/controllers/cron.php and modified the line

class CobaltControllerCron extends JControllerAdmin

to read

class CobaltControllerCronoverride extends JControllerAdmin

so that I had a new cron script that wouldn't get overwritten when I install updates of Cobalt. I then modified my new copy of cron.php to include checking for section_id and override in the URL to exclude notifications for all but the section_id in the URL and to override the user schedule to be immediate (schedule 1). Now I call the following URL to override notifications to be section_id of 5 and override alert schedules to be immediate.

 http://myhost/index.php?option=com_cobalt& ;task=cronoverride.sendAlert&secret=123456&section_id=5&override_schedule=1

override_schedule can be a value from 1 to 5 to override what is set for the user. I cron the above URL to be accessed every 5 minutes to trigger the alert.

I'm still testing but I'll post the code when it looks bug free. So far so good.


Sergey
Total posts: 13,748
25 Sep 2014 03:13

This is perfect customisation! This is exactly what I would do.

Now you have to delete chedule selector in notification settings. Because it will not longer work.

Powered by Cobalt