How can we control what's in the digest? All I can get is

Nodetype: Title
- Nodetype Title by Site Admin
Nodetype: Title
- Nodetype Title by Site Admin

What I need is something like

Title
Original Link

Basically when the user selects a time interval rather than immediate, I'd like them to get the same information that they would get in an individual e-mail, just all rolled into a single e-mail.

Comments

dfletcher’s picture

Hi HallSL. I had this same trouble, just figured out a way to do it in a custom module using hook_notifications:

function mymodule_notifications(
  $op, &$arg0 = NULL, $arg1 = NULL, $arg2 = NULL
) {

  if ($op == 'event types') {
    $types[] = array(
      'type' => 'node',
      'action' => 'insert',
      'name' => "\n[type-name] [term]: [title]",
      'line' => "[node-url]\n",
      'digest' => array('node', 'nid'),
    );
    $types[] = array(
      'type' => 'node',
      'action' => 'update',
      'name' => '',
      'line' => '',
      'digest' => array('node', 'nid'), 
    );      
    $types[] = array(
      'type' => 'node',
      'action' => 'comment',
      'name' => '',
      'line' => '', 
      'digest' => array('node', 'nid'),
    );
    return $types;
  }
}

In "name" and "line" it seems you can use any of the tokens listed in "Notifications for node events" messaging settings. It seems to be ignoring my "\n" though, I guess it's being trim()ed somewhere.

This is clumsy but at least it's a solution for the short term.

Cheers,

--fletch

dfletcher’s picture

Ugh, this fix worked for about a day, and then it stopped. I updated from a dev snapshot to the alpha release during this time, so I suppose that caused it. Looking for another solution now.

dfletcher’s picture

Aha! It's the weight that was changed between revs. The weight of notifications_content was set to 100 in this update. The trick needed to get my code above working is that it must run *after* notifications. So a quick `UPDATE system SET weight=101 WHERE name='mymodule'` seems to have fixed it.

Cheers,

--fletch

dfletcher’s picture

It's not the worlds greatest solution. I attempted to pull out the comment and update notifications this way too by making them blank - so they appear as empty bullets in the digest.

Putting some macros on comments and updates looks a tiny bit better, but not much. It really doesn't make sense to point to the same node more than once in the digest.

Cheers,

--fletch

HallSL’s picture

Thanks much. This at least gives me something that has a useful link, instead of the title twice. I really appreciate it.

jose reyero’s picture

Yeah, I had changed module weights (Some things need to happen after all the other modules have added their stuff into the node, that's why).

About this solution, it looks good, but I guess you'll like more the new
- hook_alter_notifications_event_types()
and
- theme_notifications_digest_body()
just committed.

jose reyero’s picture

Status: Active » Fixed

Also improved digest format for node creations. See http://drupal.org/node/218745

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.