diff --git a/modules/node.module b/modules/node.module index a48598fcc95cfb7c6226467571c98c6e849be811..91273da624b4f08150b09ba22e1198f4bc0fce3f 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 a48598fcc95cfb7c6226467571c98c6e849be811..91273da624b4f08150b09ba22e1198f4bc0fce3f 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);