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
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

rex_the_first - June 18, 2009 - 10:07
Version:6.x-2.0-beta5» 6.x-2.0

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

dlumberg - September 27, 2009 - 19:18

I added the following to notifications.cron.inc

// Comparison function to sort events by FMR_DATE_TIME field for digesting
function 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

rex_the_first - October 2, 2009 - 14:07

Wow, thank you.

I wouldn't have known where to begin.

 
 

Drupal is a registered trademark of Dries Buytaert.