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 2011-01-01 | YEMblog
    • great to finally meet @fractalgal and hang for a bit w her and @phishtwit #
    • listening to end of mule at beacon. sick sugaree #
    • thanks to all the followers, guest tweeter, neddy and pete!! happy 2011 #
    • end show. well done @phish cant wait to hear the ghost jam again #
    • one more auld lang syne tease to set off the crowd #
    • first tube #phish #
    • without a doubt best set of 2011 #
    • end set #phish #
    • grind #phish #
    • acapella #phish #
    • an extra peak for slave! #
    • band connects on a groove propelling jam forward #
    • slave #phish #
    • best part of this nye set 3? WE GOT ANOTHER SHOW TONIGHT #
    • tender as fuck @originalwyllys #
    • waste #phish #
    • tough harmonies #
    • hoping @dogoneblog gets his delay jam #
    • into free #
    • roygbiv chase #
    • this piper doesnt seem to have much gas behind it. lets see how the jam goes #
    • piper #phish #
    • bdtnl #phish #repeat #
    • lights say phish and 11 on the placards above stage #
    • dancers leave. afdter midnighta! #
    • balloon drop as fuck. all of auld sang by those on stage #
    • auld lang syne #
    • fish on kit #
    • those on floor have huge fingerlike balloons that fell earlier #
    • except fish who still dances #
    • band comes back in live over recording #
    • cant wait to see what they are throwing looks like on ebay tomorrow #
    • band throwing fake hot dogs into crowd #
    • trey got a hot dog from the cart #
    • band gets off hot dog #
    • band approaching stage balloons falls #
    • a guy dressed as airplane ground crew waves phish in #
    • dancers on stage wave phish in #bestbandever #
    • band throws tokens at fans from hot dog. #
    • phish emerges in hot dog. will tour ceiling of msg. rip captain beefheart #
    • one dancer in 1997 gretzky jeresey. smoke emeerges from back of floor #
    • there are hot dog carts on stagnoww. its like a bollywood drama in nyc #
    • recorded at worcester soundcheck? #
    • band disappears troupe dances ala freakapaug #
    • prerecorded meatstick plays as band members dance with crowd on stage #
    • stage overtaken by troupes singing meatstick #
    • yodelers emerge #
    • hassids sing hebrew version blonds sing sweidsh? #
    • meatstick sung in native languages #
    • tribal dance quartet chants on one side of stage. mexican mariachis on other #
    • japanese lyrics a capella #
    • meatstick #phish #
    • lights #
    • end set #
    • rab in my shoemouth vocal jam #
    • vocal jam #
    • trey still singing crab in my shoemouth during breaks #
    • bass and drum #
    • im plotzing #
    • mashup style! #
    • manteca inserted and quoted as trey solo continues #
    • this set is relentless as fuck #tiredbuthappyfeet #
    • page uses his prophet analog synth #
    • the note #
    • that ghost jam resolved all the tension in the room. such great, happy energy flowing around the garden #crunchytweet #
    • yem #phish #
    • into ghost outro. you must hear that tomorrow. #
    • hugs and hifives exchanged #
    • all four following treys lead and crowd finally goes nuts #
    • heavenly progression #
    • #thisiswhyiseephish200times #
    • mike pushes towards darkness before catching on a gorgeous riff w trey. butter jam achieved #
    • all four pushing towards a pretty, major key jam space. buttery #
    • page on electric piano as trey plays santana-esque riffs #
    • ghost. nice little segue #
    • page hops on clav #
    • powerful highly melodic jam thus far. band seems about to turn corner into weirdsville #
    • trey toying with song's theme during machine gun session #
    • no place in the world id rather be. this crowd is eating the set up #
    • such hugh energy choices this set. now lets take dwd for a long walk #
    • disease #phish #
    • auld lang syne tag at end of nicu #phish #
    • nicu #phish #
    • standardly awesome sand #
    • punchy type i jam #
    • roygbiv chase! #
    • ck5 initiates chase sequence #
    • dance party as quartet fixates on groove leading to start of trey solo #
    • insane glowstick war. kids have been saving their allowance #
    • sand #phish #
    • trey screams final 46 days before outro jam #phish #
    • arena rock peak excites crowd #
    • trey unloading on this type i solo #
    • 46 days #phish #
    • memories of 123094 #
    • wilson #phish #
    • lights #
    • end set #phish #
    • #iwastoldtherewouldbenomath #
    • according to scott marks the record for most different songs in a year was broken #bestbandever #phish #
    • trey driving at solo with dirty tone not heard yet this run #
    • (x3) #
    • weak response to nyc lyric (x2) #
    • @lsaxilla now that's great rock and roll placement #phish #
    • rock and roll #phish #
    • pa squeals #phish #
    • sounds well rehearsed #
    • gone #phish #
    • cactus bass solo #
    • cross'd off the bustout list #
    • beauty of my dreams bustout #phish #
    • about 8 measures long #
    • auld lang syne jam #phish #
    • ocelot #phish #
    • two more '10 debuts. were gonna break that record yet #
    • weigh! #phish #
    • meat and potatoes solo from Trey #
    • mid-tempo bluesy rocker #
    • burn that bridge debut after sooooo many soundchecks. green/anastasio #phish #
    • love the enthusiasm #
    • and grabbed his buddy and said "thy're gonna finish it!" #
    • the kid behind me apparently only heard the studio version of mule cause he just flipped out when they went into end of mule. #
    • scent of a mule #phish #
    • sound is marvy at my position on far page side #
    • page milks clav fish accents nicely. game on #
    • moma dance #phish #
    • the standard build but more patient than usual #
    • holy singalong #
    • nice gamehendgey start #
    • acdc bag #phish #
    • so may fans are holding glow sticks or have blinking neon lights in their costumes. looks amazing as you do a 360 of msg #
    • memories of 123195 #
    • pyite #phish #
    • lights #
    • energy continues to build. this place should explode upon lights #
    • rectangular riser of some sort lines the back of stage #phish #
    • sly stone pre show music #
    • venue nearly full. lots of nervous energy bubbling #
    • Phish New Years #10 for me! so happy its at the garden. lets make this one count #
    • getting a nice base at heartland brewery. pondering all the sogns left for tonight and 1/1 #
    • pre-show jitters kickin in hard. cant believe were almost ready for yemsgnye #phish #
    • Tonight I'm on tweets and Sammy D of @dogoneblog starts 2011 out strong for us. What a batch of guest tweeters this run!!! #
    • Woke up with a big smile on my face. Nothing quite like the vibe/energy of MSG. GREAT work by @joshkorin last night!!! Thanks, Josh! #phish #

    Post a Comment

    You must be logged in to post a comment.