I got the taxonomy term and content subscription to work where it will send out the emails immediately for the subscribed content via the queue. What I need is the ability to have several digest options, where it will send out the notifications in a pre-defined interval (like the previous version of this module). We want these options: Every Hour, Twice a Day, Daily and Weekly (along with the default immediately option). We also need to allow users to customize the setting they want to use.
So this is what I've done so far:
- I have the Scheduled Notification showing up for new content ( admin/config/messaging/notifications/scheduler )
- Under the Job Scheduler configuration, I have added the different time entries ( admin/config/system/job_scheduler )
- On the action settings page, I assigned the "Scheduled notification: New posts" options to each time trigger. ( admin/structure/trigger/job_scheduler )
I have manually created fields to user accounts that is used for the send interval and send method options. I updated the notifications_user_settings() function to grab these settings if they exist. Below is the code for this.
function notifications_user_setting($name, $account = NULL, $default = NULL) {
global $user;
$account = $account ? $account : $user;
// Default send method is taken from messaging module
if ($name == 'send_method') {
return messaging_method_default($account);
}
/*
* Chris Edit
*
* We add custom fields to the account settings area for the send_interval
* and the send_method options. This code grabs the correct value.
*/
if($name == 'send_method' || $name == 'send_interval') {
$field = 'field_notif_' . check_plain($name);
if (isset($account->$field)) {
$current_field = $account->$field;
if (isset($current_field['und'][0]['value'])) {
return $current_field['und'][0]['value'];
}
}
}
else {
$field = 'notifications_' . $name;
if (isset($account->$field)) {
return $account->$field;
}
}
// If we haven't returned by this point, grab the default settings for
// the site.
return variable_get('notifications_default_' . $name, $default);
}
The issue is that I cannot get the jobs scheduler to send out the emails. I tried to implement the patch from this thread: #1274512: Who Receives Scheduled Notifications? . But that only describes adding one option and I need to make several options available. Below is my code for notifications_queue_send_intervals() under notifications_scheduler.module .
function notifications_queue_send_intervals($account = NULL) {
return array(
'0' => t('Immediately'),
'3600' => t('Every hour'),
'43200' => t('Twice a day'),
'86400' => t('Daily'),
'604800' => t('Weekly'),
);
}
I'm just not sure where to go from here in debugging this. Any tips would be appreciated!
Comment | File | Size | Author |
---|---|---|---|
Screen Shot 2012-04-04 at 9.33.12 AM.png | 122.61 KB | chrisroane | |
Screen Shot 2012-04-04 at 9.31.54 AM.png | 60.38 KB | chrisroane | |
Screen Shot 2012-04-04 at 8.18.38 AM.png | 56.59 KB | chrisroane |
Comments
Comment #1
spgd01 CreditAttribution: spgd01 commentedAny luck with this?
Comment #2
chrisroane CreditAttribution: chrisroane commentedI ended up creating a custom solution that met our needs.
Comment #3
ghb0104 CreditAttribution: ghb0104 commentedi also want to implement the daily digest function with Drupal 7, but i do not know how to implement this function.
Any comments for this will be appreciated.
Thanks,
Comment #4
zeezhao CreditAttribution: zeezhao commentedHi. Please was the weekly digest implemented, as in D6 version?
Comment #5
glass.dimly CreditAttribution: glass.dimly commentedDigests definitely are not implemented in the D7 version. Don't let some of the options you see in the UI fool you, I've seen that this is not implemented yet--the data model to make it work is not yet implemented.
In general, I suggest using the message and message_digest module, these are a more solid framework for building digest notifications on top of.
Comment #6
apaderno