WordPress.org

Ready to get started?Download WordPress

Forums

Future Post listings in WP 2.1 (34 posts)

  1. lotech
    Member
    Posted 7 years ago #

    Future Post seems to be broken in the new super fantastic WordPress 2.1. The site I'm using it gives an events calendar with future posts/events being shown

    I had previously also made manual changes to the classes.php to enable listing of ALL posts not just ones with a dates from today backwards....

    I've spent my afternoon searching through the source code and can't find the bit where the date settings are made.

    Previously you could change/remove a line such as -
    $where .= " AND post_date_gmt <= '$now'";

    Can some one point me in the right direction?
    Thanks

  2. lotech
    Member
    Posted 7 years ago #

    That original change was in classes.php btw.
    Any help on this would be great.
    If people have got futureposts plugin actually working it would be good to know too - just in case I am a complete spaz and missing something.

  3. alexo05
    Member
    Posted 7 years ago #

    We're using WordPress MU and Future Posts are not showing up at all. They get saved and placed in the manage posts list, but they don't get published onto the site.

    I tried a standalone WP 2.1 and same thing, the post doesn't show up.

  4. lotech
    Member
    Posted 7 years ago #

    I managed to hack around with the posts.php and found that future dated posts are published to the database with the post_status of FUTURE. If you modify this to PUBLISH your posts will turn up.

    The modified posts.php is here.

    If I can work out how to, I will hopefully be able to modify the old plugin to change the necessary code in WP2.1. For now the patched file just posts all published posts as PUBLISH regardless of date.

  5. lotech
    Member
    Posted 7 years ago #

    Or should I sat it's here. Sorry.

  6. Deadpan110
    Member
    Posted 7 years ago #

    I found that in WordPress 2.0.7 classes.php can also be edited.

    I use the event calendar plugin but also found i needed to set the post timestamp due to the way I wanted my blog to work for my needs.

    Starting at line 591 in classes.php:

    $now = gmdate('Y-m-d H:i:59');
    Change to:

    $now = explode('-',gmdate('Y-m-d H:i:59'));
    $now = $now[0]+1 . '-' . $now[1] . '-' . $now[2] . $now[3];

    This sets the now date forward 1 year.

    And at line 595 in classes.php:

    if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {

    Change to:

    if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single)) {

    I wouldn't know if this works for any version other than 2.0.7 and im also unsure if this is indeed correct, but for now, it seems to work.

    For anyone else editing the WordPress files, please remember your work will be undone when you update.

  7. mycho
    Member
    Posted 7 years ago #

    Thanks for this detailed information, I have the same needs for future event posting.

    I just installed the new new version of wordpress 2.12 so i'm going to try this on it, and give any feedback here if it works - or doesn't.

  8. jaguar000
    Member
    Posted 7 years ago #

    future posting does not work in 2.1.2 :-(((

    Radek

  9. martyg
    Member
    Posted 7 years ago #

    @lotech: Thank you very much for the work. The hack in post.php works fine for me in WP 2.1.2!
    For some uses this is just great - for example when using WordPress more as an content-management-system and with hand-coded queries in one's templates to sort and display content/posts (not relying on the standard-Loop). With your hack one can have a "future posts"-category even without plugins...

  10. nolageek
    Member
    Posted 7 years ago #

    I get a blank page when I try to use this post.php.

    Using WP 2.1.3

  11. cloetensbrecht
    Member
    Posted 7 years ago #

    I found an easy solution for this:

    open -> /wp-includes/post.php
    goTo -> #562
    edit -> $post_status = 'future';
    to -> $post_status = 'publish';

    Now your future posts are saved in the database as 'publish' when you create a new post or when you update your future posts.

    Example: http://cloetensbrecht.be

  12. moseymosey
    Member
    Posted 7 years ago #

    That's an idea... thanks cloetensbrecht :)
    Have to figure out what posts to show though, since (as your demo shows) it will show all the posts, even ones far in advance... might be confusing for a few visitors.

  13. emhouston
    Member
    Posted 7 years ago #

    I have a "Coming Soon" plugin that lists the title of future scheduled posts and the date they are scheduled to appear. It is designed for the sidebar. If anyone wants it is is available at my dev site http://tukats.net/blog/2007/03/28/coming-attractions/. It works in 2.1. Haven't tested it in 2.2 yet.

  14. moseymosey
    Member
    Posted 7 years ago #

    Thanks for the info, emhouston! :) Is it possible for the user to click on the title and be taken to the post content at all?

  15. emhouston
    Member
    Posted 7 years ago #

    Right now it isn't because I'm using it for serialized fiction and I don't want users to read it before it goes 'live', I want them to sub to get it or come back to the site. That would be an easy hack though...

  16. moseymosey
    Member
    Posted 7 years ago #

    Thanks for the reply :) I will be using it for upcoming events/competitions, so it would be useful for visitors to click to see more details. I'm no PHP expert, so would I be able to contact you to find out more about the 'hack' at all please?

  17. moseymosey
    Member
    Posted 7 years ago #

    Found this which may be useful for others: http://wordpress.org/support/topic/119791?replies=5

  18. Vincent Mimoun-Prat
    Member
    Posted 6 years ago #

    This might be of interest for a full solution :
    http://www.vincentprat.info/wordpress/2007/08/03/wordpress-future-post-bug/

  19. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    WordPress does not HAVE a future posting problem. Future posting works just fine, IF your server is configured correctly.

    Future posting, as of WordPress 2.1, uses the wp-cron process to activate those posts. However, if your server does not have correct DNS resolution setup, then it cannot access itself to activate wp-cron.

    This is a problem you need to take up with your host. Why? Because wp-cron does other things too, like pingbacks and trackbacks and such. Those are all not working if you can't make wp-cron work properly. Furthermore, if it's not working, then it's slowing down your site and wasting bandwidth by trying (and failing) to work.

    Don't hack around the problem with these crappy core hacks, fix the problem by talking to your host. Tell them that your website needs to be able to access itself as a web request. Tell them to come here if they need more information, and we'll be happy to tell them why their hosting services are broken.

    More information can be found here: http://trac.wordpress.org/ticket/3565

  20. Vincent Mimoun-Prat
    Member
    Posted 6 years ago #

    Otto: thanks for the precisions. Where should I start to solve my problem with my wp-cron? I mean, what to tell to my host?

    I have noticed in my log files several lines looking like that :
    fake.ha.ovh.net http://www.vincentprat.info - [03/Aug/2007:00:00:43 +0200] "GET /wordpress/wp-cron.php?check=XXXXXX HTTP/1.0" 403 296 "-" "-"

  21. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    GET /wordpress/wp-cron.php?check=XXXXXX HTTP/1.0" 403

    A 403 error means that the document is "forbidden". This could be for several reasons. I'd check the permissions on the wp-cron.php file, make sure it's set to 444 so that it can be seen by the webserver.

    Alternately, ask your host why http://www.vincentprat.info/wordpress/wp-cron.php returns a 403 error in those cases.

  22. Vincent Mimoun-Prat
    Member
    Posted 6 years ago #

    Otto: I had checked the permissions, it is set to 644 so no problem on that side. I am trying to solve the problem with my host, he proposed me to setup a Cron task but I'd like to solve it the right way if possible. Thanks for your help.

  23. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Setting up an actual cron task won't fix the problem. You cannot replace wp-cron with normal cron. Doesn't work that way.

  24. nolageek
    Member
    Posted 6 years ago #

    Otto42:

    The problem is that some people (like myself) dont want them to sit as drafts until the future date, we want them to be regular posts that we can manipulate into upencoming even calendars, using categories etc... Since this isn't possible with WP at the moment I am still using MovableType for my reelidentities.org.

    Yes, posts are automatically posted on such-and-such date if 'future posted,' but they cannot be displayed in a calendar format that shows future posts and then have the visitor read that post.

  25. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    They're not "drafts", they're identical to normal posts, but with a "future" status.

    But you are correct that they can't be read. They haven't been published yet. If you want them to be published, then publish them now and not in the future.

  26. nolageek
    Member
    Posted 6 years ago #

    Otto42, you're missing the point. If you want to make a schedule of future events, listed as a calendar using future posts - you can't do it because they're not published. All we're asking is how to publish future dated posts.

    I help run a 3 day film festival every year and we use Movable Type as the back end. I put the films in, in the correct category tree (Films/<category>) then if I pull up, using PHP/SQL a listing of all entries in the "Films" category between the 3 dates of the festival, I can format and manipulate them around to do all sorts of things using custom fields. It's just not possible using posts that a dated now - at least it's a lot harder.

  27. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    All we're asking is how to publish future dated posts.

    I do see what you're saying, but that doesn't make any sense from the WordPress standpoint. Future posts can't be published because they haven't happened yet. The timestamp is the date that the post is published. That's sorta the whole point of the timestamp.

    Now, if you're writing your own SQL and such, you certainly can pull up future posts, just don't rely on the post_status field. And I think the get_posts() function is capable of pulling any set of posts you want, future or not. So you could use that to get and potentially display them.

  28. nolageek
    Member
    Posted 6 years ago #

    Otto.

    I know that, but without the option of having future dated post show as published, it becomes a total PHP/SQL mess and at that point, why even use wordpress for this purpose? I may as well just create a SQL database and put info in it and not even use WP. I use wordpress because it's easy to manipulate data for formatting, etc.. except for when it comes to making future events calendars using posts - you can't do it without getting messy. (I suck at raw SQL... I was using MovableType plugins to do that sort of thing.)

    If you make a future dated post and you check off 'publish' it should be *published*. Yes, you may not want it to be, but then I (and others) do. Perhaps a future version could have an option for this? (Since, apparently at one point it didn't work this way?)

    I've tried all of the event calendar plugins and they all basically work like hack/work arounds... all i want is a published post! :)

    Maybe add another status Draft/Publish

    Would the 'fix' mentioned above remedy (my) situation? I haven't tried it yet.

    this one:

    open -> /wp-includes/post.php
    goTo -> #562
    edit -> $post_status = 'future';
    to -> $post_status = 'publish';
  29. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    I may as well just create a SQL database and put info in it and not even use WP.

    Actually, I was thinking the same thing. WordPress isn't made to hold "events". It's made to hold posts and pages and categories and several other types of content, but an events calendar is outside the scope of WordPress.

    I'd say to either use a plugin or some other solution entirely. WordPress is simply not suitable for your needs.

  30. nolageek
    Member
    Posted 6 years ago #

    I think you're missing our point. *sigh*

Topic Closed

This topic has been closed to new replies.

About this Topic