node_form_submit

  1. drupal
    1. 4.7
    2. 5 node.module
    3. 6 node.pages.inc
    4. 7 node.pages.inc
Versions
4.7 node_form_submit($form_id, $edit)
5 node_form_submit($form_id, $form_values)
6 – 7 node_form_submit($form, &$form_state)

Code

modules/node.module, line 1898

<?php
function node_form_submit($form_id, $edit) {
  global $user;

  // Fix up the node when required:
  $node = node_submit($edit);

  // Prepare the node's body:
  if ($node->nid) {
    // Check whether the current user has the proper access rights to
    // perform this operation:
    $original_node = node_load($node->nid); //check access rights using the unmodified node
    if (node_access('update', $original_node)) {
      node_save($node);
      watchdog('content', t('%type: updated %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), 'node/' . $node->nid));
      drupal_set_message(t('The %post was updated.', array('%post' => node_get_name($node))));
    }
  }
  else {
    // Check whether the current user has the proper access rights to
    // perform this operation:
    if (node_access('create', $node)) {
      node_save($node);
      watchdog('content', t('%type: added %title.', array('%type' => theme('placeholder', t($node->type)), '%title' => theme('placeholder', $node->title))), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid"));
      drupal_set_message(t('Your %post was created.', array('%post' => node_get_name($node))));
    }
  }
  if ($node->nid) {
    if (node_access('view', $node)) {
      return 'node/' . $node->nid;
    }
    else {
      return '';
    }
  }
  // it is very unlikely we get here
  return FALSE;
}
?>