I have a multi-author baseball site. I want authors to be able to schedule posts to be published at one of four selected times each day. This is important because some authors write game recaps, and an auto-publish of a game recap once the following game has started is pretty worthless.

I am looking for a plugin to manage this. Through research I have found a few plugins that will pick a time between a set of times set by the admin, but I am looking for something where the Admin can set up a calendar of days/times (or range of times) to allow a post to be published and set a max number of post for each time

The Author writes his post, then is presented with a selection of dates/times to schedule the post to publish.

As I mentioned, there are similar plugins, but none I have found allow Admins to set specific times.

Does anyone know of a plugin or other method? The plugin doesn't need to be free.

Update with "Vision"

Admin settings: Set dates allowed for post publishing. Set times allowed for post publishing. Set number of posts allowed to be scheduled to publish at each time (if scheduling number has been met per slot it will not be shown to Author).

Author scheduling options: "Publish" button not present. Must choose day of the week to publish post >> Must select from available times to publish post.

Does the list of times available need to be the same across all posts, or variable depending on other factors?
–
OttoMay 6 '12 at 4:24

I hadn't really thought about it. What did you have in mind? Updated question with more info.
–
Travis PflanzMay 6 '12 at 4:43

1

This seems like it would make a pretty good plugin. I've got the publishing part and the ui for the post edit screen done but I haven't worked out the admin options yet. I'm think I will post what I have and maybe someone else can add to it.
–
Chris_OMay 7 '12 at 4:50

2 Answers
2

My approach is to create an hourly cron event that loops through all the draft status posts and checks for the publish month - date and hour saved in post_meta and publishes if scheduled date is not in the future.

A publish date and time select meta box is added to the publishing div that updates via ajax when a time is chosen.

@Todo: Create validation function for saving the options, Create a count option that stores how many posts are scheduled for each time to restrict those times once full, and clean up & document the code.

This will be made into a proper plug-in and some point. At the moment, it 'works' - but you manually configure the plug-in variables (i.e, no admin options yet).

All restrictions apply to users without the capability to manage_options (i.e. admins). But this could be altered as well.

The UI

The idea is to load javascript after the WP loads post.js (this includes the java-script that controls altering the time input. The plug-in over-rides this, clicking 'edit' for the publish time instead opens up a jQuery UI date-time picker.

The date-time picker only allows certain dates to be available given some rules (see below). All other dates are not selectable. On selecting the a date/time the appropriate WordPress fields are updated - and so WordPress handles the rest of the processing.

So this part of the plug-in only really prevents certain dates being inputed.

(The date-time picker is positioned a bit too low - something that can be smartened up using jQuery ui positioning).

Server-side checks

It also performs a check on save_post - just in case (js disabled? hack by user?) a 'forbidden' date is selected, the save_post callback checks the date again. If it is found to be invalid, the post is 'prevented' from being published/scheduled (as per this answer) and instead returned to draft status. A custom message appears (this message can be changed by setting $fail_message currently).

'days_in_week' is an array of integers to indicate which days (0=sunday, 1=monday) the user can publish dates on. Similarly 'months_in_year' stores an array of allowed months (1=january,...). Extra rules could be added quite easily (including a shortlist of admin-specified dates).

Limiting scheduled post

There is also a $limit variable which limits the number of scheduled posts a user can have. If they reach that limit, they loose the capability to publish (instead having to submit it for review - you could remove the right to even create posts, but that would prevent editing as well).