Hey all,
A need has arisen where I need to allow authors to set an 'expiration date' for the posts that they write on a blog of mine.
Now, after a wee bit of research, there seems to be a couple of existing plugins which already do something along these lines:
Atropos and Post Expirator being the plugins which popped up in a couple of different Google searches. Atropos seems to be the 'extension' of Post Expirator.
Now, Atropos allows you to set an expiration date for the post by specifying a date in a custom meta box that the plugin creates in the write posts page. This, in itself seems like a sensible approach and I've modified the plugin so that it doesn't delete the posts, but instead it marks the post as a draft. I managed this by simply modifying the atropos_delete_expired_posts() function in atropos.php
This is all well and good and does the functionality that I'm after. However, my authors are picky and like things to be easy - bless them. They're not all that happy with having to scroll to the bottom of the write posts screen to add an expiry date and they pointed that it would seem more sensible for the expiry date to be part of the "Publish" meta box on the RHS of this screen - i.e. just below the "Publish immediately" section.PHP Code:function atropos_delete_expired_posts () {
global $wpdb;
$result = $wpdb->get_results("SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = '_atropos_expiration_date' AND meta_value < '" . date("Y/m/d") . "'");
foreach ($result as $a) {
//wp_delete_post ($a->post_id); //Deleting is bad mmkay
do_action('transition_post_status', draft, publish, $a->post_id);
}
}
To be fair, that sounds like a decent suggestion, so, after all this babbling and convolution, here's my question:
Is it possible to add something to the 'publish' meta box and, if so, which functions and hooks should I be looking toward.
Thanks very much in advance!


LinkBack URL
About LinkBacks
Reply With Quote




