Ticket #1795: view-future-dated.diff
File view-future-dated.diff, 1.9 KB (added by , 19 years ago) |
---|
-
wp-includes/classes.php
13 13 var $post; 14 14 15 15 var $is_single = false; 16 var $is_preview = false; 16 17 var $is_page = false; 17 18 var $is_archive = false; 18 19 var $is_date = false; … … 534 535 } 535 536 536 537 $now = gmdate('Y-m-d H:i:59'); 537 538 if ($pagenow != 'post.php' && $pagenow != 'edit.php') { 538 539 //allow authors to preview their own future-dated posts 540 if ($this->is_single && $user_ID) { 541 $where .= " AND ((post_date_gmt <= '$now') OR (post_date_gmt >= '$now' AND post_author = $user_ID))"; 542 $distinct = 'DISTINCT'; 543 } elseif ($pagenow != 'post.php' && $pagenow != 'edit.php') { 539 544 $where .= " AND post_date_gmt <= '$now'"; 540 545 $distinct = 'DISTINCT'; 541 546 } … … 609 614 } else { 610 615 if ('draft' == $status) { 611 616 // User must have edit permissions on the draft to preview. 612 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) 617 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) { 613 618 $this->posts = array(); 619 } else { 620 $this->is_preview = true; 621 } 614 622 } elseif ('private' == $status) { 615 623 if ($this->posts[0]->post_author != $user_ID) 616 624 $this->posts = array(); 617 625 } 618 626 } 627 } else { 628 if (mysql2date('U', $this->posts[0]->post_date) > mysql2date('U', $now)) { //it's future dated 629 $this->is_preview = true; 630 } 619 631 } 620 632 } 621 633 -
wp-includes/functions.php
1399 1399 return $wp_query->is_subpost; 1400 1400 } 1401 1401 1402 function is_preview() { 1403 global $wp_query; 1404 1405 return $wp_query->is_preview; 1406 } 1407 1402 1408 function is_archive () { 1403 1409 global $wp_query; 1404 1410