diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-01-10 08:43:49 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-01-10 08:43:49 +0000 |
commit | d093f4eea1b7600e1d28e77e3154cdf97318c067 (patch) | |
tree | d8e296e87ae8c795e9845648c00ec5ba391f3599 /modules/node/node.module | |
parent | 7ea92ac319a1397687c837fdff140969f129a892 (diff) | |
download | brdo-d093f4eea1b7600e1d28e77e3154cdf97318c067.tar.gz brdo-d093f4eea1b7600e1d28e77e3154cdf97318c067.tar.bz2 |
#38451: Maintain node options when a non-admin edits a node.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r-- | modules/node/node.module | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/node/node.module b/modules/node/node.module index 65705b997..c82271aa9 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1861,16 +1861,8 @@ function node_submit($node) { else { $node->uid = 0; } - $node->created = $node->date ? strtotime($node->date) : NULL; } - // Force defaults in case people modify the form: - $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); - } - } // Do node-type-specific validation checks. node_invoke($node, 'submit'); @@ -2232,6 +2224,14 @@ function node_form_submit($form_id, $form_values) { 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)))); |