Thread Starter
pdlr
(@pdlr)
Ok, so far I have found out that future posts can only be seen by logged in users.
the weird thing is that i can see a category page (archive.php) with future posts (including content) on a browser i’m not logged in on.
but i can not see that future content as single.php. yet the code on these two templates is almost identical.this is an authentication issue, i think.i have searched for an answer, but to no avail.
any suggestions from anyone?
Thread Starter
pdlr
(@pdlr)
the reason i could not see the post in the other two browsers was because i was not logged in on them. since, i have found the following code in the $get_posts() function.
if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now)) { //it's future dated
$this->is_preview = true;
if (!current_user_can('edit_post', $this->posts[0]->ID)) {
$this->posts = array ( );
}
I think this is the line that makes future posts visible/invisible. can anyone help edit this?
Thread Starter
pdlr
(@pdlr)
the whole piece of code looks like this:
// Check post status to determine if post should be displayed.
if ( !empty($this->posts) && $this->is_single ) {
$status = get_post_status($this->posts[0]);
if ( ('publish' != $status) && ('static' != $status) ) {
if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) {
// User must be logged in to view unpublished posts.
$this->posts = array();
} else {
if ('draft' == $status) {
// User must have edit permissions on the draft to preview.
if (! current_user_can('edit_post', $this->posts[0]->ID)) {
$this->posts = array();
} else {
$this->is_preview = true;
$this->posts[0]->post_date = current_time('mysql');
}
} else {
if (! current_user_can('read_post', $this->posts[0]->ID))
$this->posts = array();
}
}
} else {
if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now)) { //it's future dated
$this->is_preview = true;
if (!current_user_can('edit_post', $this->posts[0]->ID)) {
$this->posts = array ( );
}
}
}
}
the first comment line says “Check post status to determine if post should be displayed.” so i think this is it but i am not a programmer. any help?
Well it’s a hack but if you change the line:
if ('publish' != $status) {
To:
if ( ('publish' != $status) && ('future' != $status)) {
The single post will be displayed once again…