Working with Organize Series
I mentioned recently that I’ve switched from the “In Series” plugin to the “Organize Series”. Aside from my already using the “/series” URL, and needing to change it to something else (it would be nice to see that as an option in the settings interface for the plugin), I did find one other issue that needed taking care of.
I schedule almost every one of my post. When episode commentary for episode 19 of a series appears, I may very well have scheduled episode commentaries through episode 26 to post one or two a week already.
The problem comes up when the Organize Series plugin (version 2.0.7) lists all posts in a series. If a post is scheduled to post, it would list it right along with all posted articles. This became very apparent when my inbox started to flood with 404 errors from search engine bots frantically trying to follow links for posts that aren’t scheduled to post until a later date.
There is a file in the plugin called “series-utility.php”. There’s a section around line 250 that looks like this:
foreach ($posts as $spost) {
if (array_key_exists('object_id', $posts)) {
$spost_id = $spost['object_id'];
} else {
$spost_id = $spost;
}
if ($skip && $spost_id == $postid) continue;
$currentpart = get_post_meta($spost_id, SERIES_PART_KEY, true);
$series_posts[$key]['id'] = $spost_id;
$series_posts[$key]['part'] = $currentpart;
$key++;
}
I modified it to check if a post’s “post_status” variable is set to “publish” (excluding “draft” and “scheduled” and “private” before adding a post to the list:
foreach ($posts as $spost) {
if (array_key_exists('object_id', $posts)) {
$spost_id = $spost['object_id'];
} else {
$spost_id = $spost;
}
if ($skip && $spost_id == $postid) continue;
$post = get_post($spost_id);
if ($post->post_status == "publish") {
$currentpart = get_post_meta($spost_id, SERIES_PART_KEY, true);
$series_posts[$key]['id'] = $spost_id;
$series_posts[$key]['part'] = $currentpart;
$key++;
}
}
I haven’t had any issues with using “$post” as the variable name, but if it somehow conflicts with the page’s post, then changing it to another name (such as $apost) would solve this.
Now when a list of links to posts in a schedule is generated, I don’t have to worry about all my scheduled posts appearing and sending people (and search engines) to 404 error pages.
I’ll be e-mailing the author of the plugin about this, so if the problem hasn’t already been fixed, he’ll be able to put in this change. In the meantime, maybe anyone else looking for a way around this bug will find this post. I am surprised that this issue hasn’t been tackled prior to this. Is it uncommon to schedule posts in a series? I’d think this is the type of situation, posting a series of posts, where scheduling would be used the most.
August 11th, 2008 at 2:32 pm
Thanks Chris for coming up with a fix. When I get around to publishing an update for orgSeries I’ll include this and credit you :)
September 26th, 2008 at 4:30 pm
Chris,
Thanks for the suggestions. I’ve just started scheduling my posts recently and discovered this issue too.
I’m writing a novel and publishing it in draft form by scenes on my web site. I’m using OrganizeSeries 2.0.7 with WordPress 2.5.1, and have my options set to “display the list of series on the posts page”. That means that when you’re reading an individual post in the series, you see a full list of other series posts embedded in the post window, including those already published and those scheduled to be published.
I thought your fix might be just the ticket to resolve that. Unfortunately, it worked a little differently than expected for me. I modified my series-utility.php file as outlined and pushed it up to my site. The change eliminated the future scheduled posts from the list of series on the post pages. In fact it eliminated all of the posts from the list of series on the post pages.
Were you trying to affect the list in the post pages? Or did your change target the “post list” in the widget sidebar (which I have disabled on my site)?
Any suggestions would be appreciated!
Cheers!
Perkins
http://richard-rowland-perkins.com/series/doormakers-fall/
September 26th, 2008 at 8:55 pm
Hello Richard,
I’m looking at some of your posts, and things look the way I would expect them to. Did you revert the change, or did you find a solution to the issue you were facing?
One possiblity is if you copy and pasted from my code directly, the line “publish” might have caused problems. This is because it should be "publish", but WordPress makes the quotes become “”. (In case this might cause a problem for others, fixed it in the post up above.)
The list on the post pages is what I targeted with this fix.
Hopefully any issues will find themselves resolved quickly. Software should do what we want it to!
September 26th, 2008 at 9:40 pm
I did in fact revert to the original series-utility.php file. I also “unscheduled” all of my scheduled posts, just to clear up the menu.
Now I’ve changed the quotation type as you suggested and tried again, and it seems to work: my chapter 11 scene 3 post (which is scheduled for later tonight) is not showing up in the menu!
I’ll wait for it to publish automatically, see how everything looks after that, and let you know.
Thanks for the help!
Perkins
September 26th, 2008 at 10:00 pm
Update
Well the issue with scheduled posts in the menu appears to be fixed, but there’s another problem.
When wordpress published my scheduled post, it lost the series association for it. That post is published now, but shows up as No Series in the manage posts page and, correspondingly doesn’t show up in the series either.
That’s probably a discussion for another thread though, unless you have some suggestions on that front? Thanks for all of your help so far anyway.
Cheers
Perkins
September 26th, 2008 at 10:01 pm
I’m glad to hear things are looking up! WordPress’s automatic curly quotes seems to be the bane of PHP code posters everywhere =P
September 26th, 2008 at 10:04 pm
About losing the series, offhand I doubt that that is related to this change. I’d say to add it back to the series, and then keep a watch and see if it continues to happen. If reverting the change back to the original file fixes things, then at least that will prevent further issues.
One possibility is that you forgot to add that one post to the series. I forget to add a series sometimes, but if you’re certain you added it, then that wouldn’t be the cause. I’d definitely say to watch and see if it occurs again.
September 27th, 2008 at 10:02 am
Unfortunately this glitch happens with or without the change. When I write a post, add it to a series, and schedule it to be published at a later date, it retains its connection to the series until the moment wordpress publishes it. (Meaning that I can see what series number it is in my manage posts screen)
But as soon as the post gets published, the post shows up as no series. It’s like the scheduled post function loses or strips some of the meta data somewhere.
Publishing immediately does not have the same effect: posts retain their series connections just fine that way. But whenever I schedule something it gets pulled out of the series.
Does this ever happen to you?
September 27th, 2008 at 10:28 am
I haven’t had the problem you describe (I’m using WordPress 2.5.1 as well). There are so many variables that can be causing a problem like that, so it would be difficult to determine even where to begin diagnosing such a problem.
I’ve even had problems where multiple copies of a post were being saved as new drafts, and when I switched my web server software from Apache to Nginx, that went away. That doesn’t make any sense, but that’s how it happened for two WordPress blogs for me!
And upgrading WordPress is out until/if the Organize Series plugin supports 2.6.
If I were facing the problem you’re seeing, one thing I’d probably investigate is the –er, wait. I just checked my latest posts, and I am seeing the same problem as you’re having! My most recent scheduled posts are not part of a series. Oh bother!
I won’t have time to look into this this weekend (I’m preparing character information as my first step toward NaNoWriMo this year), but this is something I will have to investigate one of these weekends.
It looks like we’re in the same boat on this bug.
September 27th, 2008 at 10:33 am
It appears there’s a post on the plugin forum about this issue: Future dated post error.
September 27th, 2008 at 11:26 am
Small world. I’m trying NaNoWriMo this year for the first time as well.
http://www.nanowrimo.org/eng/user/311801
I read through the forum post you suggested, but it looks like there’s been no action on that thread for a few months, (besides yours…)
Best of luck with NaNoWriMo.
Cheers,
Perkins
October 10th, 2008 at 7:43 am
I’ve released a beta of Organize Series 2.0.8 that works with WP2.6+ and “hopefully” takes care of the future publishing issue :)
– Darren
October 10th, 2008 at 4:54 pm
Thanks for the heads-up, Darren! I’ll try it out first on a new site of mine that’s already on the latest WordPress, and if everything looks good, The Pink Sylphide‘ll see itself upgrading, as well.