Email notification of new story submission?
SavoryMedia - February 1, 2006 - 23:49
I'm going through the notification modules (Notify and Subscription) and have tried both out and neither seem to do what I want them to do:
Basically, I just need Drupal to email all admins when someone submits a news story node to the moderation queue. That's it.
Is there ANY way to easily do this?!?

+1
+1
If +1 means important, me
If +1 means important, me too. By role would be nice. By vocabulary by role (e.g. for each vocabulary, assign a role or roles to be notified) would be even better.
Anyone? Anyone? Beuller?
Anyone? Anyone? Beuller? Beuller?
=========================================
MJ - SavoryMedia - http://savorymedia.com/
Hello?
C'mon. Most portal systems have this basic functionality. Is there NO way to do this?
I'd code a quick module myself, but I'm not a coder.
=========================================
MJ - SavoryMedia - http://savorymedia.com/
Similar feature needed
I need to do something similar using Flexinodes. When a new one is posted to the queue I need to be informed. Has anyone had any luck with this?
This is a no-brainer
It would be impractical for an admin to refersh the content page all day-long waiting for new submissions.
Trolls always say to stop complaining and write it yourself
I've created a module that does this, my first 'real' drupal module.
I'm waiting for my employer to give me the go-ahead. If not, then I will submit the module without my employers endoresement.
'sup, folks.
It's not quite what you're looking for, but if you have the actions module enabled, here's something a friend whipped up. Create a file called flexerxes.module with the following content and enable it in the usual manner:
<?phpfunction flexerxes_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Performs an action on flexinode creation. (requires actions module)');
}
}
function flexerxes_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
switch( $op ) {
case 'insert':
if ($node->type == 'flexinode-1') {
actions_do( 1, $node );
}
break;
}
}
That assumes that this is flexinode content - plug in 'story' or whatever would be appropriate for your needs. This also assumes that action 1 is configured with the actions module to send an email to an administrator. If yours is something else, then change it to actions_do( x, $node);, etc, where X is the correct number.
how to adapt for multiple actions that sent emails
I have several forms on my site that put data into flexinode types, and I need to notify one person for each flexinode type that accepts data from these forms. But what I mean is if someone submitts flexi type one I need to notify person A and if someone submitts flexi type 2 then I need to notify person B, and so on...
Can I just set up your code as an if/then to determine which flexi type and send the email to the appropriate person depending on:
if ($node->type == 'flexinode-1') {
actions_do( 1, $node);
}
if ($node->type == 'flexinode-2') {
actions_do( 2, $node);
}
(and then have the 'actions' 1 and 2 set up properly within the actions module)
Sorry to ask, I am familiar with Drupal and some coding, I just haven't yet written any code for drupal myself.
Thanks for any help!
B~
Yup
Yup, you can. I just tried it myself (4.7.0), works like a charm!
Thanks Squidgy, for sharing this!
This is how I've set it up.
adminnotify.module:
<?php
function adminnotify_help($section)
{
switch ($section)
{
case 'admin/modules#description':
return t('Performs an action on flexinode creation. (requires actions module)');
}
}
function adminnotify_nodeapi(&$node, $op, $teaser = NULL, $page = NULL)
{
switch( $op )
{
case 'insert':
if ($node->type == 'flexinode-3') // change '3' to corresponding flexinode
{
actions_do( 1, $node ); // change '1' to corresponding action
}
elseif ($node->type == 'flexinode-2') // change '2' to corresponding flexinode
{
actions_do( 2, $node ); // change '2' to corresponding action
}
break;
}
}
?>
Thanx 4 tha snippet!
Thanks for laying it out for me, I some how managed to butcher the first example into a frustrating and non-working waste of time. I swear a little knowledge is a dangerous thing...
thanks for posting an actual snippet, I'm about to test it in my setup (fingers crossed...)
Now if anyone knows how to take more control over the flexinode create node screens? (?q=node/add/flexinode-1)
I tried to write my own page to intake the data but forgot to include the call to get the correct nid to write the data to, and now that I have realized I need to include it, I can't figger out how/where to do so.
Thanks again,
B~
Works great!
Thanks again, I have got my solution (based on the last snippet) up and running. I am currently up to 7 different flexinode types and 7 individual recipients for new submission notices without a single glitch or miss-fired email yet :)
Now the next question is....
Is there a way to pass the submitted values to the event.module such that they could be displayed in the email? I suppose it would actually be easier to call the values directly from the database, so... how could that be accomplished? Simply pass the nid somehow then call the values?
Any ideas?
TIA!!!
B~