summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-includes/functions-post.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-11-14 16:04:14 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2005-11-14 16:04:14 +0000
commit19f55afaf36cf96e43234ea9655f5752cadfaab3 (patch)
tree4c249fad7b1dbdeb62a86ea6859ab27f61462ed5 /wp-inst/wp-includes/functions-post.php
parent37f4745bd187688d671658a709ca9cffb43efbca (diff)
downloadwordpress-mu-19f55afaf36cf96e43234ea9655f5752cadfaab3.tar.gz
wordpress-mu-19f55afaf36cf96e43234ea9655f5752cadfaab3.tar.xz
wordpress-mu-19f55afaf36cf96e43234ea9655f5752cadfaab3.zip
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@434 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-inst/wp-includes/functions-post.php')
-rw-r--r--wp-inst/wp-includes/functions-post.php30
1 files changed, 26 insertions, 4 deletions
diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php
index 9f368ee..9134244 100644
--- a/wp-inst/wp-includes/functions-post.php
+++ b/wp-inst/wp-includes/functions-post.php
@@ -54,10 +54,17 @@ function wp_insert_post($postarr = array()) {
$post_name = sanitize_title($post_name);
}
- if (empty($post_date))
- $post_date = current_time('mysql');
- if (empty($post_date_gmt))
- $post_date_gmt = get_gmt_from_date($post_date);
+
+ // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
+ if (empty($post_date)) {
+ if ( 'draft' != $post_status )
+ $post_date = current_time('mysql');
+ }
+
+ if (empty($post_date_gmt)) {
+ if ( 'draft' != $post_status )
+ $post_date_gmt = get_gmt_from_date($post_date);
+ }
if ( empty($comment_status) ) {
if ( $update )
@@ -382,6 +389,21 @@ function wp_update_post($postarr = array()) {
$postarr = array_merge($post, $postarr);
$postarr['post_category'] = $post_cats;
+ // Drafts shouldn't be assigned a date unless explicitly done so by the user
+ if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
+ ('0000-00-00 00:00:00' == $post['post_date']) )
+ $clear_date = true;
+ else
+ $clear_date = false;
+
+ // Merge old and new fields with new fields overwriting old ones.
+ $postarr = array_merge($post, $postarr);
+ $postarr['post_category'] = $post_cats;
+ if ( $clear_date ) {
+ $postarr['post_date'] = '';
+ $postarr['post_date_gmt'] = '';
+ }
+
return wp_insert_post($postarr);
}