order the messages in the digest
rex_the_first - April 29, 2009 - 14:36
| Project: | Notifications |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi,
Thanks for such a useful module. It is almost perfect for me!
The only thing I wanted to know is can you order the messages in the digest?
I have set up the digest to send out new Calender events. At the moment they come through in the order the event pages are created but I would like the events to be in the order that they will happen in the date field (an ideally they would only get sent when the date is in the future so people don't get old events).
Thanks again

#1
Hi,
Thanks for such a useful module. It is almost perfect for me!
The only thing I wanted to know is can you order the messages in the digest mode on dependant on a token (e.g. a date field)?
I have set up the digest to send out new Calender events. At the moment they come through in the order the event pages are created but I would like the events to be in the order that they will happen in the date field (an ideally they would only get sent when the date is in the future so people don't get old events).
Thanks again
#2
I added the following to notifications.cron.inc
// Comparison function to sort events by FMR_DATE_TIME field for digestingfunction notifications_events_compare($a, $b) {
if ($b->objects['node']->INSERT_SORT_FIELD_HERE < $a->objects['node']->INSERT_SORT_FIELD_HERE) {
return 0;
}
return 1;
}
then I modified notifications_process_compose and added the following line at the top of the function:
uasort($events, 'notifications_events_compare');#3
Wow, thank you.
I wouldn't have known where to begin.