Michael Heilemann.
If you have Dunstan's Time Since installed, this plugin uses it for the title="" attributes on the comments and posts. (For WordPress 1.5) Author: Brian Meidell Author URI: http://meidell.dk/ Version 1.5: Now works without LOCK TABLE and CREATE TEMPORARY TABLE priviledges. Version 1.5.1: Can't remember what I did here Version 1.5.2: Fixed count select statement to not include spammy comments Version 1.5.3: Properly excludes track- and pingbacks Version 1.5.4: Excludes posts that are not published, even if they have comments Version 1.5.5: Fade old comments, fixed bug that wreaked havoc with Time Since Version 1.5.6: Bugfix from Jonas Rabbe (http://www.jonas.rabbe.com/) pertaining to timesince Version 1.5.7: Bugfix so old colors can be darker than new colors (stupid oversight), thanks to http://spiri.dk for spotting it. Bugfix where single digit hex would cause invalid colors, thanks to http://www.wereldkeuken.be/ for the fix. Version 1.5.8: Updated to work with WordPress 2.1 alpha by M. Heilemann. */ function blc_latest_comments($num_posts = 5, $num_comments = 6, $hide_pingbacks_and_trackbacks = true, $prefix = "
  • ", $postfix = "
  • ", $fade_old = true, $range_in_days = 10, $new_col = "#444444", $old_col = "#cccccc") { global $wpdb; function clamp($min, $max, $val) { return max($min,min($max,$val)); } $usetimesince = function_exists('time_since'); // Work nicely with Dunstan's Time Since plugin (adapted by Michael Heilemann) // This is compensating for the lack of subqueries in mysql 3.x // The approach used in previous versions needed the user to // have database lock and create tmp table priviledges. // This uses more queries and manual DISTINCT code, but it works with just select privs. if(!$hide_pingbacks_and_trackbacks) $ping = ""; else $ping = "AND comment_type<>'pingback' AND comment_type<>'trackback'"; $posts = $wpdb->get_results("SELECT comment_post_ID, post_title FROM ($wpdb->comments LEFT JOIN $wpdb->posts ON (comment_post_ID = ID)) WHERE comment_approved = '1' AND $wpdb->posts.post_status='publish' $ping ORDER BY comment_date DESC;"); $seen = array(); $num = 0; if($fade_old) { $max_time = $range_in_days * 24 * 60 * 60 ; $r_new = hexdec(substr($new_col, 1, 2)); $r_old = hexdec(substr($old_col, 1, 2)); //$r_min = min($min, $max); //$r_max = max($min, $max); $r_range = ($r_old-$r_new); $g_new = hexdec(substr($new_col, 3, 2)); $g_old = hexdec(substr($old_col, 3, 2)); //$g_min = min($min, $max); //$g_max = max($min, $max); $g_range = ($g_old-$g_new); $b_new = hexdec(substr($new_col, 5, 2)); $b_old = hexdec(substr($old_col, 5, 2)); //$b_min = min($min, $max); //$b_max = max($min, $max); $b_range = ($b_old-$b_new); } // print "ranges: $r_range, $g_range, $b_range
    "; // print "r: ".(0.5*$r_range+$r_new)."
    "; foreach($posts as $post) { // The following 5 lines is a manual DISTINCT and LIMIT, // since mysql 3.x doesn't allow you to control which way a DISTINCT // select merges multiple entries. if(array_key_exists($post->comment_post_ID, $seen)) continue; $seen[$post->comment_post_ID] = true; if($num++ > $num_posts) break; $commenters = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(comment_date) AS unixdate FROM $wpdb->comments WHERE comment_approved = '1' AND comment_post_ID = '".$post->comment_post_ID."' $ping ORDER BY comment_date DESC LIMIT $num_comments;"); $count = $wpdb->get_var("SELECT COUNT(comment_ID) AS c FROM $wpdb->comments WHERE comment_post_ID = $post->comment_post_ID AND comment_approved = '1' ".$ping); $i = 0; $link = get_permalink($post->comment_post_ID); if($usetimesince) $title = " title=\"Last comment was ".time_since($comment->unixdate)." ago\""; else $title = ""; echo $prefix."".stripslashes($post->post_title). "  ".$count."
    \n"; foreach($commenters as $commenter) { if($usetimesince) $title = " title=\"Posted ".time_since($commenter->unixdate)." ago\""; if($fade_old) { $diff = time() - $commenter->unixdate; $r = round($diff/$max_time*($r_range))+$r_new; $r = clamp(min($r_new, $r_old), max($r_new, $r_old), $r); $g = round($diff/$max_time*($g_range))+$g_new; $g = clamp(min($g_new, $g_old), max($g_new, $g_old), $g); $b = round($diff/$max_time*($b_range))+$b_new; $b = clamp(min($b_new, $b_old), max($b_new, $b_old), $b); $r_hex = str_pad(dechex($r), 2, '0', STR_PAD_LEFT); $g_hex = str_pad(dechex($g), 2, '0', STR_PAD_LEFT); $b_hex = str_pad(dechex($r), 2, '0', STR_PAD_LEFT); $colstr = " style=\"color: #".$r_hex.$g_hex.$b_hex.";\""; } if($i++ > 0) echo ", "; echo "comment_ID."\"$title>".stripslashes($commenter->comment_author).""; } if($count > $num_comments) echo " [...]"; echo "".$postfix."\n"; } } ?> @YEMblog Twitter Updates for 2010-12-28 | YEMblog
    • Phish @ Worcester, December 27 2010 Setlist and Recap http://j.mp/f3s7zF #phish #worcester #
    • Thanks again for following the yemblog tonight. Great seven below and a strong start to the nye run. good night! #
    • Thanks Again to Scott Marks For Tweeting From Tonight's Show. @ericwyman will be on tweets tomorrow #
    • End show #
    • Loving cup #
    • End set #
    • Just got a text asking me if trey said "boots." apparently i wasn't the only one who heard it #
    • Pardon the segue tweet sent to blog in error. Also, not sure if i heard take care of your boots at the end of cavern? quick bowie intro #
    • > bowie! #
    • We'll see. only marked >s that i was sure of. don't think there was a pause btwn possum and cavern :) #
    • 12/27 Set2: Mike's > Mound, Weekapaug, Farmhouse, -7 -> What's The Use? > 20 Years, Wading, Possum > Cavern http://j.mp/f3s7zF #phish #
    • > cavern #
    • Quick return #
    • Weird breakdown #
    • Possible > into possum? also possible roses > ice > mist. hard to tell w/o listening to the soundboard #
    • Possum #
    • Weird energy flow tonight. #
    • 12/27 Set2: Mike's > Mound, Weekapaug, Farmhouse, -7 -> What's The Use? > 20 Years, Wading http://j.mp/f3s7zF #phish #
    • Wading #
    • > 20 years later #
    • 12/27 Set2: Mike's > Mound, Weekapaug, Farmhouse, Seven Below -> What's The Use? http://j.mp/f3s7zF #phish #
    • Looks like there's a what's the use sign in the crowd. #
    • > what's the use #
    • Beautiful melody by trey during this jam #
    • Seth yacavonne is two people down from me. A bit surreal shaking hands with somebody who i saw performing on stage with phish last time … #
    • Seven below #
    • Solid mikes groove, but farmhouse hurts the energy of the set. #
    • 12/27 Set2: Mike's > Mound, Weekapaug, Farmhouse #phish #
    • Farmhouse #
    • There's a black rhombus being rotated on the floor. think i saw it at manchester as well. #
    • Mike's grooves with one song in the middle seem rare this year… #
    • Fishman Discussed Why The Band Didn't Play Mound in The September '10 Issue of Modern Drummer (Not Online) #
    • Weekapaug. No segue #
    • 10 to tie last year's song total, 11 for the win #
    • Last Mound 8/1/09 = 74 Shows #phish #
    • My first mound in 139 shows. A little excited here #
    • Worcester1 Set2: Mike's > Mound http://j.mp/f3s7zF #phish #
    • > mound! #
    • Glowring burst at start of the jam. Mike seems louder in set 2 #
    • Mikes #
    • Lights #
    • Set Times – 8:14 start 9:29 finish = 75 Minutes [via @phanart] #phish #
    • Set highlight for me was cool it down. Julius was a rocking closer, but not too much else re: jams. typical set 1. #
    • 12/27 Set 1: Sample, Funky Bitch, Cool It Down, Roggae, Heavy Things, What Things Seem, Roses>Ice, Mist, Julius http://j.mp/f3s7zF #phish #
    • End set #
    • Julius #
    • Mountains in the mist #
    • Okay, we've got Scott Marks hooked directly into the feed now. Thanks again to Scott for stepping in during our moment of need. #
    • The winter theme continues #
    • 12/27 Worcester: Sample, Funky Bitch, Cool It Down, Roggae, Heavy Things, What Things Seem, Roses > It's Ice http://j.mp/f3s7zF #phish #
    • It's Ice #phish #
    • Appropriate take a piece of tinsel and put it on the tree lyric #
    • Crowd Goes Nuts #
    • Roses Are Free #phish #
    • 2nd Version of Song off Mike's Moss Album. Debuted on 10/11/10 #
    • 12/27 Worcester: Sample, Funky Bitch, Cool It Down, Roggae, Heavy Things, What Things Seem http://j.mp/f3s7zF #phish #
    • What Things Seem #phish #
    • After Cool It Down, 11 More, Different Songs Need To Be Played in 2010 to Tie Last Year's Total. 12 FTW (thanks to @zzyzx for info) #phish #
    • Heavy Things #phish #
    • Getting in at 7:30 was a bit chaotic. Maybe two sets of lines to get people in when it looked like there were way more doors & security #
    • La Grange Banner From Camden and Miami '09 Is On Display Again. Only One Laser So Far Tonight #
    • 12/27 Worcester: Sample, Funky Bitch, Cool It Down, Roggae http://j.mp/f3s7zF #phish #
    • Roggae #phish #
    • Of all the cold/ice/snow themed songs this didn't come to mind earlier. Bravo, Phish! #
    • Last Cool It Down = 11/28/2009 #
    • Cool It Down #phish #
    • 12/27 Worcester: Sample, Funky Bitch http://j.mp/f3s7zF #phish #
    • @originalwyllys is having phone difficulties so Scott Marks of the @phishnet team has stepped in and will relay commentary. Sorry folks #
    • Funky Bitch #phish #
    • Sample #
    • Reaaaady #
    • Were ready. Brian is out . Is time #
    • ready #
    • FYI, NYE RUN TWEETERS: 12/27 = @originalwyllys 12/28 = @ericwyman 12/30 = Scott Marks 12/31 = ScottyB 1/1 = @dogoneblog #phish #
    • @Phanart Wade Wilby aka @originalwyllys is on tweets tonight [-scotty] #
    • Biiig love vibe at Hampton Inn. People psyched for each other making it here. #emotionalshiz #phish #
    • Crushington State's own Shawn at the room. #sophisticatedpregamebudwicks #phish #
    • Show 108 for the kid tonight. #phish #
    • Headed to Hampton Inn for pregame. My official opener call is -7. #phish #
    • Mass Pike is golden. #phish #
    • Just got off exit for auburn. Leg 1 finished. #phish #
    • Haha. Duly noted CGlush. I will speak of snow no more. Safe travels to all. #phish #
    • CGlush- Just making mention of the weather stranding many fans. A blizzard caused that. Once again, sorry stranded phans #phish #
    • On the road. Old school crew. Destined As Fuck. #phish #blizzardshowspwn #
    • Phish Makes Billboard's Hot Tours List http://bit.ly/fVuNUX #phish #
    • Watching -7 you tubes. Getting stoked. Sorry to all who got stranded. We'll all rage it twice as hard #
    • Leaving CT at 1:30. This stream is dedicated to Eloose "Tiny Rager" McRageberts. Sorry babe #
    • To be tweeting for yemblog tonight. Blizzard shows FTW #phish #
    • I'm so excited #
    • Programming Note: @originalwyllys will be guest tweeting today and tonight. @dogoneblog will tweet for us on 1/1. Safe travels, all! #
    • MSG Run Forecast = 12/30: Sunny, High of 39 12/31: Sunny, High of 46, 1/1: Sunny, High of 46 http://bit.ly/fBrmJp #phish #yemsg #
    • Be sure to visit our Facebook Page to get your Pick Three entries in for tonight's show http://www.facebook.com/yemblog #phish #
    • The Show Goes On RT: @dcucenter Tonight's Phish concert will go on as scheduled at 7:30PM – doors open at 6:30PM. #phish #

    Post a Comment

    You must be logged in to post a comment.