• Resolved Janko

    (@janko)


    Hi,

    I need a plugin or another solution to allow not registered users viewing posts with “future” post_status.
    I have already plugin that allows posts with timestamp in the future to be shown, and they are shown in the loop, but if visitor isn’t admin 😉 then he can’t open single “future-post” page, it acts like a draft entry (404 error).

    I know, that there is a plugin that swaps post_status of future-placed posts from “future” to “publish” and then everyone can see it but I’d like to keep “future” status for another purpose…
    So, is there any way to make posts with future timestamp generally accessible?
    Maybe to work on something with user roles?

    Thanks in advance,
    Janko

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter Janko

    (@janko)

    Mmm maybe someone could just point me where in WordPress is the place that makes entries with post_status=future invisible (“draft” too should be there)?

    Thread Starter Janko

    (@janko)

    Bump bump… please 😉 .

    Thread Starter Janko

    (@janko)

    Thanks for reply, Michael. I’ve analyzed this plugin, however there is nothing about displaying posts that are usually hidden :/ …

    Maybe from another side – how to let everyone view draft posts (just as they would be published, but without changing “draft” post status)?

    kahitano

    (@kahitano)

    hello, I need a plugin like the one you’re using. I need a plugin which will still display the future posts…what are you using?

    Thread Starter Janko

    (@janko)

    Hi, im using, or rather intending to use this plugin:

    <?php
    /*
    Plugin Name: The Future is Now!
    Description: Display posts with a timestamp in the future.
    Version: R1.0.1
    */
    
    function show_future_where($where) {
    	global $wpdb;
    
    	if( !is_single() && !is_page() )
    		$where .= " OR $wpdb->posts.post_status = 'future' ";
    
    	return $where;
    }
    
    add_filter('posts_where', 'show_future_where');
    ?>

    …but it works only when you are logged in as admin, otherwise future posts are invisible 🙁 .
    I believe that there is a simple solution to override some permissions, but I don’t know how to do that…

    kahitano

    (@kahitano)

    oh, thank you, but I was really intending that guests will be able to see future posts, and they are published already.

    i was making an event calendar that way…

    Thread Starter Janko

    (@janko)

    Yeah, me too. I hope that one day some kind of php/wordpress geek will come in here and help us 😛 .
    Meanwhile, you can use this plugin http://wordpress.org/extend/plugins/the-future-is-now/
    It is ok but it changes post status from “future” to “published”, that’s the way how it works, and you can’t use “future” parameter to filter posts only to the upcoming ones.

    Again about my problem – If I would use mentioned plugin then I need just a script that would reject posts older than today (showing only “upcoming” posts, like using post_status=future but in this case we can’t do this this way). Yeah, just it :P… Maybe someone know how to do that?
    I tryed to write this script several times, but it didn’t worked 🙁 …

    Janko: I’ve got a similar need/problem and I too have tried the plugin above (The Future is Now!, Version: R1.0.1 with the code posted above, not the one by shacker and rboren which you link to. It’s confusing, because they are named the same but achieve their goals differently).
    I’m working on a sort of game that unfolds over time, so I want to pre-write my wordpress content and have the posts appear over time. But I need to preview the ‘future’ posts now. So I’m working on a plug-in based on the Future Is Now!
    My problem is different than yours: unlike you, I can view my ‘future’ posts when I’m logged in as admin OR NOT. My problem is that the ‘future’ posts display in every category, whether I want them to or not (i.e.; PostX in Category A with a status of ‘future’ displays at the top of Categories A, B and C; PostY in Category B with a status of ‘published’ and a past date displays (correctly) only in Catagory B).
    Do you have this problem? If not, I suspect our problems might relate to our versions of WordPress or maybe the theme files we’re using.
    I’m using WP 2.5 and my theme is based on ‘Vertigo Blue’.
    I’m a WP noob, not a guru, so I just hammer away, trial-and-error. Any light you can shed?

    Thread Starter Janko

    (@janko)

    Hi,
    I don’t have time to check it now 😛 but I will check it in a few days and post here what I will figure out.
    …and I still haven’t found solution to my problem, so I will work on it soon and we both should make use of it. Keep in touch!

    Hi,
    I fixed my problem, so I thought I’d let you know in case it will solve yours.

    I found what I think was an earlier version of ‘The Future Is Now!’ (the Version: R1.0.1 one you quote above). Instead of

    function show_future_where($where) {
    	global $wpdb;
    
    	if( !is_single() && !is_page() )
    		$where .= " OR $wpdb->posts.post_status = 'future' ";
    
    	return $where;
    }

    He used

    function show_future_where($where) {
    	return str_replace('(post_status = \'publish\' OR post_status = \'private\')', '(post_status = \'publish\' OR post_status = \'private\' OR post_status = \'future\')', $where);
    }

    This didn’t work for me as is, but I stripped it back to:
    return str_replace(‘post_status = \’publish\’ ‘, ‘post_status = \’publish\’ OR post_status = \’future\”, $where);
    (got rid of the ‘private’ and some brackets). That did the trick for me.
    Paul

    Thread Starter Janko

    (@janko)

    Hey, that works! You are incredible, thanks a lot 😀 !

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Showing future-timestamp posts to everyone’ is closed to new replies.