Resources

My Agape try

Your Agape try


Support Forum

You must be logged in to post Login Register

Search 
Search Forums:


 




Future-Dated private Posts

UserPost

11:43 pm
February 2, 2011


metal450

Member

posts 178

1

Hey Kevin,

Another bug report for you with regards to future-dated posts.  Note that I'm currently using 1.3.25, though since the following issue wasn't mentioned in the two changelogs since then I figured I'd wait to upgrade to avoid having to do two full runs of testing.


As we'd discussed in a previous thread, the standard behavior for Scheduled Posts is for them not to appear in the main blog listings, but to be accessible to the admin/author via direct URL.  That works properly.

The issue I found has to do with future-dated posts that are marked as Private (which aren't classified by Wordpress as "Scheduled", apparently).  These posts DO appear in main blog listings for the admin.  What that means is, let's say I've future-dated one post a day for seven days, three of which are private, and they're all mixed in with each other.  If I look at the main blog page today, it'll show those 3 private posts on top - as if they've already been published.  Then as the days elapse, the non-private scheduled posts will begin to appear inbetween.  The ordering won't be correct until after the supposed publication date of the final private post.


That's problem #1. Problem #2, which is more serious, pertains to other (non-admin) users who have permission to view those private posts.  Although they cannot view them until the scheduled date (as is supposed to happen), the post title DOES appear for them as a next/previous post link, so they're aware of its existence before it actually "publishes" and becomes accessible.  Obviously while the first problem is a "convenience" one as seen by the admin, this second one is a "security" one as it reveals information that's not yet supposed to be visible (and provides links to articles that aren't actually accessible).

3:09 pm
February 7, 2011


Kevin

Admin

posts 2503

2

In my WP 3.0.4 trial with twentyten and no plugins, future-dated private posts are visible to a logged Editor (both in the default posts listing and via direct URL). That behavior is mirrored by Role Scoper when granting a Category or Post role containing the read_private_posts capability.

Can you confirm the default WP behavior? Apparantly your date-blocking is being applied by your theme code? I need to track down the source of your "default" behavior before attempting to preserve it.

11:25 pm
February 7, 2011


metal450

Member

posts 178

3

Regarding the 2nd issue: of course, without Role-Scoper, nobody but the admin/author/editor would be able to see the private posts anyway - so there isn't really default behavior to reproduce.  However, as the reader can see next/previous links to posts that they cannot access (i.e. they lead to a 404), this seems like a pretty straightforward bug.

Regarding the 1st issue: You're right; my bad, that's actually how it behaves without Role-Scoper as well.  I didn't even check because it just seemed very weird to have future-dated public posts not show up until their supposed publication date, but future-dated private posts all appearing immediately.  It effectively makes these private posts push everything else down, so the frontpage of the blog no longer represents for the admin what a logged-in user would see.  Weird.

3:26 pm
February 8, 2011


Kevin

Admin

posts 2503

4

metal450 said:

Regarding the 2nd issue: of course, without Role-Scoper, nobody but the admin/author/editor would be able to see the private posts anyway - so there isn't really default behavior to reproduce.  However, as the reader can see next/previous links to posts that they cannot access (i.e. they lead to a 404), this seems like a pretty straightforward bug.

But in my test installation a WP Editor can read future-dated private posts with or without Role Scoper active. So this is what I'm having trouble reproducing:

(non-admin) users who have permission to view those private posts. Although they cannot view them until the scheduled date

Do you also have a Reader restriction set on the post in question?

12:42 pm
March 11, 2011


Kevin

Admin

posts 2503

5

Are you still seeing this problem?

3:46 am
March 13, 2011


metal450

Member

posts 178

6

I haven't done any future-dated private posts in awhile, but as of the last time I checked, yep.  And yes - I have a Reader restriction set.

9:56 am
March 18, 2011


Kevin

Admin

posts 2503

7

You're right that setting private visibility clears the "scheduled" status. And without the scheduled status, WP does not natively apply a date-limiting clause to queries. You can see this with with future-dated private posts when logged in as an Editor using the default theme and no plugins. I have to conclude that the inability of your authorized users to view those posts before their "publish date" must be due to some additional filtering enforced by your theme code. The WP behavior here is inconsistent but at this point it looks inappropriate for me to modify Role Scoper to impose suppression of future-dated posts (regardless of post status) as the new default behavior.

Instead, you can your extend your custom-suppression of those posts by hooking onto the following WP filters:

  • get_previous_post_where
  • get_next_post_where

…and appending a date clause

10:25 pm
April 24, 2011


metal450

Member

posts 178

8

Weird - a reference search of the WP core didn't turn up either of those filters.  Do those only apply to the next/previous links?  Thus, the following should be sufficient to do what I'm looking for?


add_filter( 'get_previous_post_where', 'filter_private_future_nextprevious_links' );
add_filter( 'get_next_post_where', 'filter_private_future_nextprevious_links' );
function filter_private_future_nextprevious_links($where)
{
    return $where . " AND post_date_gmt < '" . current_time( 'mysql', 1 ) . "'";
}

6:17 am
April 25, 2011


Kevin

Admin

posts 2503

9

Yes, try searching on get_{$adjacent}_post_where

9:16 am
April 25, 2011


metal450

Member

posts 178

10

Seemed to work…thanks!


On an unrelated note, 1.3.30 isn't showing its changelog on Wordpress.org ;)

9:49 am
April 25, 2011


Kevin

Admin

posts 2503

11

On an unrelated note, 1.3.30 isn't showing its changelog on Wordpress.org ;)


I don't have control of that. There is a delayed refresh on the "Last Updated" date too.

Here's the change log for 1.3.30:

* Compat : Fatal error when another plugin defines pluggable function 'set_current_user' (call to undefined function plural_name_from_cap_rs)

9:51 am
April 25, 2011


metal450

Member

posts 178

12

Ah…a mini-update :)


About the Agapetry forum

Currently Online:

13 Guests

Maximum Online: 150

Forums:

Groups: 2

Forums: 7

Topics: 1246

Posts: 5654

Members:

There are 1257 members

There are 1 guests


Kevin has made 2503 posts

Top Posters:

metal450 - 178

Ragnar - 108

YikYak - 70

whiteorb - 49

Daisy - 35

Administrator: Kevin | Moderators: Kevin