Ticket #1795: view-future-dated.2.diff
File view-future-dated.2.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 //only select past-dated posts, except if a logged in user is viewing a single: then, if they 540 //can edit the post, we let them through 541 if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) { 539 542 $where .= " AND post_date_gmt <= '$now'"; 540 543 $distinct = 'DISTINCT'; 541 544 } … … 609 612 } else { 610 613 if ('draft' == $status) { 611 614 // User must have edit permissions on the draft to preview. 612 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) 615 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) { 613 616 $this->posts = array(); 617 } else { 618 $this->is_preview = true; 619 } 614 620 } elseif ('private' == $status) { 615 621 if ($this->posts[0]->post_author != $user_ID) 616 622 $this->posts = array(); 617 623 } 618 624 } 625 } else { 626 if (mysql2date('U', $this->posts[0]->post_date) > mysql2date('U', $now)) { //it's future dated 627 $this->is_preview = true; 628 if (!current_user_can('edit_post', $this->posts[0]->ID)) { 629 $this->posts = array ( ); 630 } 631 } 619 632 } 620 633 } 621 634 -
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