The page you are looking at now is at this URL: http://pastoid.com/b2d
This paste was last updated on June 21, 2010 at 1:04 pm.
Index: commonblocks.plugin.php =================================================================== --- commonblocks.plugin.php (revision 3220) +++ commonblocks.plugin.php (working copy) @@ -136,12 +136,26 @@ $limit = 5; }; - $block->recent_comments = Comments::get( array( - 'limit'=>$limit, - 'status'=>Comment::STATUS_APPROVED, - 'type'=>Comment::COMMENT, - 'orderby'=>'date DESC', - ) ); + $offset = 0; + $published_posts = 0; + $content = array(); + + do { // get the comments + $content = Comments::get( array( + 'limit'=>$limit, + 'status'=>Comment::STATUS_APPROVED, + 'type'=>Comment::COMMENT, + 'offset'=>$offset, + 'orderby'=>'date DESC', + ) ); + // check the posts + foreach ($content as $comment ) { + if ( $comment->post->status ) == Post::status( 'published' ) { ++$published_posts; } + } + } while ( $published_posts < $limit ); + + // return the first {$limit} posts + $block->recent_comments = array_slice( (array) $content, 0, $limit ); } public function action_block_content_recent_posts( $block, $theme )
| Referring Domain | Hits |
|---|---|
| Unknown Referer | 127 |
| pastoid.com | 28 |
Tip: Use Pastoid to shorten URLs with this bookmarklet: Pastoid This