Hi,
Tried using it. But it doesn't seem to prune the posts.
I set it to delete after 24 hours, but it doesn't seem to delete anything.
Is there a way to check it?
Hi,
Tried using it. But it doesn't seem to prune the posts.
I set it to delete after 24 hours, but it doesn't seem to delete anything.
Is there a way to check it?
hey,
there seems to be a bug in the plugin.
it uses a function hat only loads the last 5 posts of a category instead of load all posts.
additionally there is a barrier so that the prune process is only triggert once a hour.
Workarounds:
For the major bug: (Line near 135 of file auto-prune-post.php)
Replace
$myposts = get_posts("category=" . $cat_i);
with
$args = array( 'numberposts' => -1, 'category' => $cat_id );
$myposts = get_posts($args);
For testing do the prune on every page hit:
Line 127 of file auto-prune-post.php: add a new line to set $lastrun false every time (remove this line after testing)
$lastrun = get_transient('auto-prune-posts-lastrun');
$lastrun = false;Hey Shofer,
Thank you very much. It solved my problem.
Do I understand it correctly that the prune process is still only triggert once a hour?
as long as you don't have the
$lastrun = false
line inserted the process is only triggert once a hour.
This line makes only sense in case of testing.
So you don't need to wait a hour to do your next test.
Oh, so if the line $lastrun = false is included it runs every time someone goes to the website (wordpress frontend) and otherwise a visit will only trigger the auto prune process if this has not happened in the last hour.
Thank you.
Thanks Shofer for reacting to handig !
I just saw this topic.
As for the "bug" to only take 5 posts and once an hour, this is intentional to reduce potential serverloads.
I am working on a new version on which the timeout is 30 minutes and it will clear all posts:
/**
* Uses transient instead of cronjob, will run on wp call in frontend.
*/
function prune() {
$lastrun = get_transient('auto-prune-posts-lastrun');
if (false === $lastrun) {
$force_delete = ($this->conf['settings']['force_delete'] == 0) ? false : true;
// Walk
foreach($this->conf['config'] as $cat_id => $type)
{
foreach($type as $the_type => $values)
{
$period_php = $values['period_php']; // Will be in format so strtotime can handle this [int][space][string] example: "4 day" or "5 month"
// Get all posts for this category
$myposts = get_posts('category=' . $cat_id.'&post_type='.$the_type.'&numberposts=-1');
foreach ($myposts AS $post) {
$post_date_plus_visibleperiod = strtotime($post->post_date . " +" . $period_php);
$now = strtotime("now");
if ($post_date_plus_visibleperiod < $now) {
// GOGOGO !
//$this->delete_post_and_attachments($post->ID,$force_delete);
// Mail admin?
if(!empty($this->conf['settings']['admin_email']))
{
$body = "DEMO, no post is delete DEMO Deleting post ID : ".$post->ID. "\n";
$body .= "Post title : ".$post->post_title. "\n";
$body .= "Settings (Delete or Trash) : ".( ($force_delete) ? 'Delete' : 'Trash' ). "\n";
wp_mail($this->conf['settings']['admin_email'],'Plugin auto prune posts notification',$body);
}
}
}
}
}
//set_transient('auto-prune-posts-lastrun', 'lastrun: '.time(), 60*30); // 60*30 = 30 minutes
}
}Any word on when the new version will be released?
@Ryanmc : the expectation (planning) is somewhere next week, but certainly not on Monday
Next week was two weeks ago. Should I start editing existing code or wait a few more days?
It is in trunk -> http://wordpress.org/extend/plugins/auto-prune-posts/download/, please have some patience.
I'm away this weekend.
I have just committed version 1.1:
= 1.1 =
Second release<br/>
Added: Custom post type support<br>
Added: Trash OR force delete option<br>
Added: Mail admin if post is deleted<br>
Changed: Init method is now every 30 seconds, all posts are checked.<br>
Added: If you add &prune=true in your admin plugin page the plugin will run manually (force run)<br>The upgrade seems to have messed up the WP UI using multisite, I have no other options other than dashboard which has nothing on it but news & blog. No way to get to or edit anything else and now I have a "Auto prune posts plugin updated to new version" line at the top of my site. Something is not right with the upgrade.
The update notice will only show once.
I had to completely uninstall the plugin after the upgrade. It rendered the wordpress UI useless. The left menu only had options for Dashboard(which only contained wp news and wp blog) and Profile, thats it! Could no longer get to anything else within the WP UI. After uninstall all returned to normal.
Is there any way you can retrieve your PHP error logs (of the day you installed and noticed the error) and sent them to me?
Sorry it took so long. I really don't have a way to access but I did for the sake of trying, install the plugin fresh to the network and same result. The upgraded version does not work well with multisite, not as in working incorrectly, but bombs out the WPUI. Not sure if that is a known issue with multisite but figured I would put it out there. The old version works fine.
Hmm interesting, as the previous version compared to this one does not have lots of GUI stuff differences.
I'll try to setup a network over here on a clean install and see what happens. If your pages are completely blank ( so white page ) I would really appreciate an error log file.
The pages are not blank the WP UI look and feel are there, its just missing any options. The left menu only has options for Dashboard(which only contained wp news and wp blog) and Profile, thats it! Could no longer get to anything else within the WP UI. After uninstall all returned to normal.
Are you running PHP4 or PHP5 ?
PHP5
I am currently looking into this. Looks as if this has something to do with the submenu creation by my plugin.
Update: the problem lies in the is_admin() function.
Stand by for the new version.
This topic has been closed to new replies.