Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.772 diff -u -p -r1.772 node.module --- modules/node/node.module 10 Jan 2007 08:43:49 -0000 1.772 +++ modules/node/node.module 10 Jan 2007 10:25:22 -0000 @@ -1,5 +1,5 @@ uid = 0; } + $node->created = $node->date ? strtotime($node->date) : NULL; } + // Process the workflow options and provide defaults. If the user + // can not administer nodes, ignore the form and either use the + // saved values if the node exists, or force the defaults. + if (!$access && $node->nid) { + $saved_node = node_load($node->nid); + } + else { + $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); + } + foreach (array('status', 'promote', 'sticky', 'revision') as $key) { + if (!$access && $node->nid) { + $node->$key = $saved_node->$key; + } + else if (!isset($node->$key) || !$access) { + $node->$key = in_array($key, $node_options); + } + } + // Do node-type-specific validation checks. node_invoke($node, 'submit'); node_invoke_nodeapi($node, 'submit'); @@ -2224,14 +2243,6 @@ function node_form_submit($form_id, $for drupal_set_message(t('The %post has been updated.', array ('%post' => node_get_types('name', $node)))); } else { - // Add defaults for new nodes - $access = user_access('administer nodes'); - $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); - foreach (array('status', 'promote', 'sticky', 'revision') as $key) { - if (!$access || !isset($node->$key)) { - $node->$key = in_array($key, $node_options); - } - } node_save($node); watchdog('content', t('@type: added %title.', array('@type' => t($node->type), '%title' => $node->title)), WATCHDOG_NOTICE, l(t('view'), "node/$node->nid")); drupal_set_message(t('Your %post has been created.', array ('%post' => node_get_types('name', $node))));