diff options
author | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-04-08 13:13:17 +0000 |
---|---|---|
committer | Gerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org> | 2006-04-08 13:13:17 +0000 |
commit | 8e1e221e3075f13e007f375201a32abf09779faa (patch) | |
tree | c1a84f42d06e1a574a9a443184f25578eb09a0ae /modules | |
parent | 9794b5538e2baee159d360c9f7125f178591659a (diff) | |
download | brdo-8e1e221e3075f13e007f375201a32abf09779faa.tar.gz brdo-8e1e221e3075f13e007f375201a32abf09779faa.tar.bz2 |
#52710, fix node timestamp for admin users, patch by hunmonk.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/node.module | 13 | ||||
-rw-r--r-- | modules/node/node.module | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/modules/node.module b/modules/node.module index a48598fcc..91273da62 100644 --- a/modules/node.module +++ b/modules/node.module @@ -1503,7 +1503,7 @@ function node_submit($node) { $node->uid = 0; } - $node->created = strtotime($node->date); + $node->created = $node->date ? strtotime($node->date) : NULL; } else { // Force defaults in case people modify the form: @@ -1629,7 +1629,16 @@ function node_form_array($node) { // Node author information $form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 20); $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => theme('placeholder', variable_get('anonymous', 'Anonymous'))))); - $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date); + $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25); + // For new node creations only display a reference to the time of creation, + // so node creation time defaults to form submission time. + if (!isset($node->nid)) { + $form['author']['date']['#description'] = t('Format: %time (defaults to time of form submission)', array('%time' => $node->date)); + } + else { + $form['author']['date']['#default_value'] = $node->date; + $form['author']['date']['#required'] = TRUE; + } // Node options for administrators $form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25); diff --git a/modules/node/node.module b/modules/node/node.module index a48598fcc..91273da62 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1503,7 +1503,7 @@ function node_submit($node) { $node->uid = 0; } - $node->created = strtotime($node->date); + $node->created = $node->date ? strtotime($node->date) : NULL; } else { // Force defaults in case people modify the form: @@ -1629,7 +1629,16 @@ function node_form_array($node) { // Node author information $form['author'] = array('#type' => 'fieldset', '#title' => t('Authoring information'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 20); $form['author']['name'] = array('#type' => 'textfield', '#title' => t('Authored by'), '#maxlength' => 60, '#autocomplete_path' => 'user/autocomplete', '#default_value' => $node->name ? $node->name : '', '#weight' => -1, '#description' => t('Leave blank for %anonymous.', array('%anonymous' => theme('placeholder', variable_get('anonymous', 'Anonymous'))))); - $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, '#required' => TRUE, '#default_value' => $node->date); + $form['author']['date'] = array('#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25); + // For new node creations only display a reference to the time of creation, + // so node creation time defaults to form submission time. + if (!isset($node->nid)) { + $form['author']['date']['#description'] = t('Format: %time (defaults to time of form submission)', array('%time' => $node->date)); + } + else { + $form['author']['date']['#default_value'] = $node->date; + $form['author']['date']['#required'] = TRUE; + } // Node options for administrators $form['options'] = array('#type' => 'fieldset', '#title' => t('Publishing options'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 25); |