Redirect only after inserting a new node? I had a rule of 'After saving new content' of type, redirect to url. I need to add second submit button to the content type so I decided to add the redirect to a custom module so I can have different actions depending on the button. The redirect works on the submit button but I only want this to happen when adding/inserting a new node. Right now it redirects every time the submit button is clicked.

In mymodule_form_alter:

$form['actions']['submit']['#submit'][] = 'submission_form_submit';


Then:

function mymodule_form_submit($form, &amp;$form_state) {  
  $form_state['redirect'] = 'info-received';
}


Code suggestions needed. But if there is a way to have rules perform different actions based on which button is clicked I can use that advice also.

ETA: the code used for the second button

$form['actions']['submit_another'] = array(
  '#type' =&gt; 'submit',
  '#name' =&gt; 'save_another',
  '#value' =&gt; t('Save, and Add Another.'),
  '#submit' =&gt; array('node_form_submit','submission_form_create_duplicate_form_submit'),
  '#weight' =&gt; 40,  
);


ETA2: Trying is_new

function mymodule_form_submit($form, &amp;$form_state) {  
  $node = $form_state['node'];

  if(isset($node-&gt;type) &amp;&amp; $node-&gt;type == 'submission') {
    dsm('Reached Node Type Check!'); // &lt;- this works

    if (isset($node-&gt;is_new)) {
    dsm('Reached New Node Check!'); // &lt;- this does not work
    $form_state['redirect'] = 'info-received';
    }
  } 
}


Changed the if statement checking for new node to

if ($node-&gt;is_new) {    


Results in 'Notice: Undefined property: stdClass::$is_new in mymodule_form_submit()' 

It seems the value for is_new is not set.
You could use hook_node_insert() under this hook should use drupal_goto() for redirect. The hook_node_insert() only trigger when a new node inserted. If you also want to update. You could use hook_node_update().