Is there such thing as a post-save type of case in the node_api function or any other type of function? This question is in reference to a question I posted What operation should I use to write node's information in an email when the node is saved?

I want to be able to have something happen after pressing the save button, but AFTER the saving into the database has been completed. I have tried 'update' and 'insert' and they don't seem to work.

EDIT: heres my code

case 'presave':
        if(($node->type == 'team_practice_info') | ($node->type == 'schedule'))

                if($node->field_alert[0]['value'] == 'on')
                    //email out to everyone an email about the content change/update
                    $query = db_query("SELECT * 
                                       FROM {content_type_athletics_alert}
                                       JOIN {content_field_team}
                                       ON content_type_athletics_alert.nid = content_field_team.nid
                                       WHERE content_field_team.field_team_nid = 
                                            (SELECT field_team_nid
                                             FROM {node}
                                             JOIN {content_field_team}
                                             ON node.nid = content_field_team.nid
                                             WHERE node.nid = %d)", $node->nid);
                    $rows = array();
                    //db_fetch returns an array of the next row in the query
                    while ($row = db_fetch_array($query))
                        //pull out the email from the array, then send an email to each subscriber                          
                        $email = $row['field_email_address_value'];
                        $first_name = $row['field_first_name_value'];
                        $last_name = $row['field_last_name_value'];
                        $t_id = $row['field_team_nid'];
                        $sport = (current($t->taxonomy));
                        $team = $t->title.' '.$sport->name;

                        alert_message_mail_send($email, $first_name, $last_name, $team, $node);
                    //reset the alert checkbox to off
                    $node->field_alert[0]['value'] = 'off';

  • The 'insert' and 'update' $op work perfectly for me (and have done for a couple of years now), can you post the code you're using that doesn't work? To answer your question, no, there isn't a 'post-save' $op, as that is taken care of by 'insert' and 'update'
    – Clive
    Commented May 7, 2012 at 17:43
  • I've written a module that provides what you're looking for. You can find the details here : stackoverflow.com/questions/5308465/post-save-callback
    – Sina Salek
    Commented Jun 4, 2014 at 11:20

2 Answers 2


If you are having trouble with hook_nodeapi (though I have never had problems with it), you could try using Rules.

There is a stock event After saving new content that you can try. There is also a stock DO action, Send a mail to a user. You then get the normalish token-based email form that you can configure.

We have used this on few projects with good luck.

  • Everyone is saying that they don't have any issues with node_api, there must be some way of fixing my problem without having to use a different module.... Commented May 8, 2012 at 19:01

Use the register_shutdown_function. Here's the code for drupal 7, modify it for drupal 6 as needed:


function your_module_node_update($node){    
    if($node->type == 'your_node'){
  • see drupal_register_shutdown_function
    – Arosboro
    Commented Jun 8, 2013 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.