Commit 6ee8563e authored by Dries's avatar Dries
Browse files

- Patch #114822 by Neil et al: revision flag was ignored.

parent be6c0be4
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment