Post status = future. #2426

git-svn-id: https://develop.svn.wordpress.org/trunk@3514 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-02-12 07:41:56 +00:00
parent bde96bc025
commit f156e83af5
10 changed files with 52 additions and 36 deletions

View File

@@ -72,6 +72,9 @@ function wp_insert_post($postarr = array()) {
$post_date_gmt = get_gmt_from_date($post_date);
}
if ( 'publish' == $post_status && (mysql2date('U', $post_date_gmt) > time()) )
$post_status = 'future';
if ( empty($comment_status) ) {
if ( $update )
$comment_status = 'closed';
@@ -204,6 +207,9 @@ function wp_insert_post($postarr = array()) {
add_post_meta($post_ID, '_wp_page_template', $page_template, true);
}
if ( 'future' == $post_status )
wp_schedule_event(mysql2date('U', $post_date_gmt), 'once', 'publish_future_post', $post_ID);
do_action('save_post', $post_ID);
do_action('wp_insert_post', $post_ID);
@@ -455,6 +461,18 @@ function wp_update_post($postarr = array()) {
return wp_insert_post($postarr);
}
function wp_publish_post($post_id) {
$post = get_post($post_id);
if ( empty($post) )
return;
if ( 'publish' == $post->post_status )
return;
return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id));
}
function wp_get_post_cats($blogid = '1', $post_ID = 0) {
global $wpdb;