From 625b69e001e5f00b840924a0320c2880f5d3bf11 Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> Date: Sat, 25 Mar 2006 19:32:14 +0000 Subject: [PATCH] #55550, if editing a node, node author changes to user editing it, patch by merlinofchaos --- modules/node.module | 12 +++++++----- modules/node/node.module | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/modules/node.module b/modules/node.module index a62f0dbc88d8..d3eba09ec599 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1580,14 +1580,11 @@ function node_submit($node) { $node->created = strtotime($node->date); } else { - // Validate for normal users: - $node->uid = $user->uid ? $user->uid : 0; // Force defaults in case people modify the form: $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) { $node->$key = in_array($key, $node_options); } - unset($node->created); } // Do node-type-specific validation checks. @@ -1704,9 +1701,8 @@ function node_form_array($node) { if (!isset($node->nid)) { foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) { $node->$key = in_array($key, $node_options); - // Don't show node options if the user doesn't have admin access. - $form['options'][$key] = array('#type' => 'value', '#value' => $node->$key); } + $node->uid = $user->uid; } else { // Nodes being edited should always be preset with the default revision setting. @@ -1728,6 +1724,12 @@ function node_form_array($node) { $form['options']['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky); $form['options']['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => $node->revision); } + else { + // Put all of these through as values if the user doesn't have access to them. + foreach (array('uid', 'created') as $key) { + $form[$key] = array('#type' => 'value', '#value' => $node->$key); + } + } // Add the buttons. $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 40); diff --git a/modules/node/node.module b/modules/node/node.module index a62f0dbc88d8..d3eba09ec599 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1580,14 +1580,11 @@ function node_submit($node) { $node->created = strtotime($node->date); } else { - // Validate for normal users: - $node->uid = $user->uid ? $user->uid : 0; // Force defaults in case people modify the form: $node_options = variable_get('node_options_'. $node->type, array('status', 'promote')); foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) { $node->$key = in_array($key, $node_options); } - unset($node->created); } // Do node-type-specific validation checks. @@ -1704,9 +1701,8 @@ function node_form_array($node) { if (!isset($node->nid)) { foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) { $node->$key = in_array($key, $node_options); - // Don't show node options if the user doesn't have admin access. - $form['options'][$key] = array('#type' => 'value', '#value' => $node->$key); } + $node->uid = $user->uid; } else { // Nodes being edited should always be preset with the default revision setting. @@ -1728,6 +1724,12 @@ function node_form_array($node) { $form['options']['sticky'] = array('#type' => 'checkbox', '#title' => t('Sticky at top of lists'), '#default_value' => $node->sticky); $form['options']['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => $node->revision); } + else { + // Put all of these through as values if the user doesn't have access to them. + foreach (array('uid', 'created') as $key) { + $form[$key] = array('#type' => 'value', '#value' => $node->$key); + } + } // Add the buttons. $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 40); -- GitLab