From 6ee8563edbd2ef7002ccc8cc1527e0abc9be27b6 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 1 Mar 2007 18:18:22 +0000 Subject: - Patch #114822 by Neil et al: revision flag was ignored. --- modules/node/node.module | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'modules/node/node.module') diff --git a/modules/node/node.module b/modules/node/node.module index 98eae0e42..192509e27 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1842,8 +1842,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; @@ -1855,24 +1854,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'); @@ -1973,16 +1954,15 @@ function node_form($node, $form_values = NULL) { $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) { + 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 -- cgit v1.2.3