? files ? sites/localhost.c-5 ? sites/all/modules ? sites/all/themes Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.776.2.2 diff -u -F^f -r1.776.2.2 node.module --- modules/node/node.module 6 Feb 2007 08:23:20 -0000 1.776.2.2 +++ modules/node/node.module 28 Feb 2007 08:35:23 -0000 @@ -1866,8 +1866,7 @@ function node_submit($node) { $node->teaser = isset($node->body) ? node_teaser($node->body, isset($node->format) ? $node->format : NULL) : ''; } - $access = user_access('administer nodes'); - if ($access) { + if (user_access('administer nodes')) { // Populate the "authored by" field. if ($account = user_load(array('name' => $node->name))) { $node->uid = $account->uid; @@ -1879,24 +1878,6 @@ function node_submit($node) { $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'); @@ -1993,18 +1974,17 @@ function node_form($node, $form_values = } $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); - // If this is a new node, fill in the default values. - if (!isset($node->nid)) { - foreach (array('status', 'promote', 'sticky', 'revision') as $key) { + // If this is a new node or we don't have access to set posting options, fill in the default values. + if (!isset($node->nid) || !user_access('administer nodes')) { + foreach (array('status', 'promote', 'sticky') as $key) { $node->$key = in_array($key, $node_options); } global $user; $node->uid = $user->uid; } - else { - // Nodes being edited should always be preset with the default revision setting. - $node->revision = in_array('revision', $node_options); - } + // Always use the default revision setting. + $node->revision = in_array('revision', $node_options); + $form['#node'] = $node; // Add a log field if the "Create new revision" option is checked, or if the