Support » Plugin: Auto Prune Posts » [Plugin: Auto Prune Posts] Doesn't work on WordPress multisite

Viewing 15 replies - 1 through 15 (of 22 total)
  • 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.


    For the major bug: (Line near 135 of file auto-prune-post.php)
    $myposts = get_posts("category=" . $cat_i);

    $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.

    Plugin Author ramon fincken


    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 !
    							// Mail admin?
    								$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?

    Plugin Author ramon fincken


    @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?

    Plugin Author ramon fincken


    It is in trunk ->, please have some patience.

    I’m away this weekend.

    Plugin Author ramon fincken


    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.

    Plugin Author ramon fincken


    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.

    Plugin Author ramon fincken


    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.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘[Plugin: Auto Prune Posts] Doesn't work on WordPress multisite’ is closed to new replies.