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-10-31 | YEMblog
    • Thanks all for the kind words and @heyscottyb for the opportunity to interact w the community on such a fun night-it was tough to keep up! #
    • God bless America and @YEMblog #boardwalkhall #phish http://yfrog.com/f3gebwj #
    • Get on the (rhom)BUS #phish http://yfrog.com/mgv8vej #
    • @jpatl in snl voice – really? Really?!? Whole lotta love – theme of the show in reply to jpatl #
    • Special thanks for dr heady for statistical services this evening #
    • Venue staff sweeping and leaf blowing glowsticks off stage hilarious #
    • WLL post show on PA smooth cover #
    • Place goes insane #
    • WLL jam big rock ending #
    • Trey pacing headbanging loving it #
    • Trey pacing under ck5 purples #
    • Tweeprise #
    • Lights on either side of the segments that make up the concave roof here – CK5 using them w pastels here #
    • @subtle_sounds yes thank you #phish in reply to subtle_sounds #
    • Monkey #
    • End set 11:37 #
    • *he's #
    • The security guard in our row smiles at GTBT – then again hrs rocking a glow stick in his sweater… #
    • Eruption #
    • GTBT #
    • Trey tells mike one more #
    • Type I version so far nice trey soloing tho #
    • #line #
    • *an #
    • Some of the best phish lyrics in a while – plus wasn't the dude of life and original member of Zeppelin? #
    • Mikes… Show of life #
    • Trey talks to mike… Page #
    • Still type one Bowie but some melodic as… Action #
    • Ck5 multi color inverted cone beauty #
    • Boomerangish intro deep mike #
    • Bowie #
    • Back to the theme #
    • Trey themeing all over the 2001s this tour have been solid massive upgrade over 09 #
    • Thick mike has the crowd bumping during 2001 here ck5 bright lights on AC #
    • Felt like matt Lawrence did at the roxy just now – throw my iPhone in the air.. During the tweez #
    • Dark and purple lights from ck5 and bam #
    • Lovely weirdness #
    • No theme yet #
    • Sustain haze > 2001 #
    • @drewphish the sweetest of TREATS #phish in reply to drewphish #
    • Halleys #
    • The jokes on us phans – u think mike was running the ustream – or Jared. Love these guys #
    • WTF ftw #
    • And she's buying …. Big rock ending #
    • Loose but outrageous #
    • Vox Trey #
    • Obv zep song I'm too dumb to ID -> tweezer theme -> stairway jam!!! #
    • Trey shit eating grin #
    • Here's page … Freedom I hold dear #
    • Trey vox – didn't page sing alpine version? #
    • On! #
    • Ramble #
    • In case you can't tell BHall is going crazy – might even say bananas #
    • Melodic Trey sounds freeish or like end of theme #
    • Don't pump ur own gas in jersey it's leded as fuck #
    • I couldn't ID what was before heartbreaker but it was Trey only zep tease #
    • W Trey vox #
    • Soaring Trey outta the WLL tease with zep tease now heartbreakers #
    • Whole lotta tweez #
    • Trey wades over to page chopping em down #
    • FTR WLL jam in possum vs full deal w lyrics in dust #
    • As @colforbin states whole lotta possum #
    • WLL jam – Jimmy page as efffff… Aw FUCK #
    • The cardboard rhombus from Manchester is about 10th row page (@beaucolburn @ericwyman) #
    • Possum #
    • Nice Trey pedal usage before the return #
    • Chopping away – tempo picks up crowd loving it #
    • Trey flutters some sweetness highup the doc #
    • Tube #
    • Trey conf page and mike #
    • Short breaks #
    • Lights 10:16 #
    • @subtle_sounds I want to try hop slam who has mine ? #beer #phish in reply to subtle_sounds #
    • As w all fall several cameramen shooting HD vid #
    • Ck5 and crew talking at lightboard in animated fashion #
    • Set I: rocking high energy sat stuff highlights – wholelottadust, wolfmans ,Gin #
    • End Set rather – Twitter doesn't like "set" #
    • Page solo obv #
    • Coil #
    • Great (type I) gin #
    • Fast tempo – trey low on the doc #
    • Playing as a unit here very nice to hear #
    • Trey modulating the theme early in solo – rhythm picks up #
    • Double fisting here … Trying to reply to the @'s on berry #
    • Big page! #
    • Here's the gin! #
    • @jeditang yes in reply to jeditang #
    • Upon further review w @brando25 the segue was a bit lazy / could have been better coming out of the tempo switchup. Ernie's ball 3rd and 3 #
    • Undermind #
    • Trey leading into undermind #
    • Tempo switchup #
    • Trey repeating over the rhythm mid to low doc #
    • Reaching for typeII… #
    • Page clav #
    • Dropping it down into a rhythmic jam nice! #
    • Vox jamming over playing #
    • Thx to action Jackson for sacrificing the cdt->whole lotta to get me a hop devil #legit #
    • The crowd breathes in the funk after going bananas for the classic rock meltdown #
    • Trey queues page up… Wolfmans #
    • Trey raging it reminds of Hartford 6/17 #
    • Fish kicking it in to support treys solo – good stuff #
    • Barely > #
    • Walk away #
    • Hahaha #
    • Short Whole lotta but more than a jam #
    • Trick or treat ustream sndchk… Trick. Love it #
    • But > #
    • Bit of pause back into dust #
    • -> #
    • Trey xhording whole lotta love into it fully!!! #
    • They have line array repeaters above the sbd due to looong venue fwiw #
    • Trey knee pumping and bopping – solo, ck5 theming w warm colors #
    • Saturday night energy ripping through as Trey blast the chords #
    • CDT #
    • @beaucolburn correctly states it was an impressive glowie war #
    • Back on #
    • Lights off #
    • Trey getting involved #
    • Glow sticks during long pause #
    • Ck5 sending the spikey wheels around the arched ceiling of b hall… #
    • Thinking about beer – they have Avery hop devil on tap, impressive… I need a runner! #
    • Crowd like it Trey spicing up the intro a bit prelyrics #
    • Guelah #
    • @hottubgin heya thx for checking out my maiden @YEMblog voyage! #
    • -30db earplugs are great to block out chatty custies fwiw – here's looking at you in 104 E #
    • *from last night #
    • The Manteca sign for last night is back in a diff location – fishman side stage #
    • Trey talks to mike, jumps up and down and FOam #
    • Cavern – trey hopping like mad at beg. Kdf = avg great #
    • Cavern Trey hopping like mad #
    • Crowd going nuts and … KDF #
    • KDF #
    • Lights 8:17 #
    • Much more pro crowd tonight last night lots of amateurs – sec104 (again) perfect mix of lights/sound/closeness #
    • Spotty on both T and VZ in here right now – hope gets better at lights but bear w us here #
    • Inside kuroda and garry at stations but floor still filling #
    • Dark here in AC, world series firing up as is the scene here on the boardwalk -how's everybody feeling tonight!? #phish #
    • Please tell the phish community where this was sourced from! Natch “@RunawayJimPVD: Drinking a Bells Hopslam right out of the bottle…” #
    • Testing from the backup berry u #
    • No spoilers tonight from me FYI – seems like two rumors taking the lead but that's all I'll say on that front #
    • Riding the rail at #whitehouse #phish http://yfrog.com/n3mm8osj #
    • Backwards down the #whitehouse line #phish #wook http://yfrog.com/n3au7xj #
    • Showered, humming night nurse and headed to White House twitpic to come #
    • Good morning Gamehenge! This is JRaras tweeting live from the wookie beach club aka AC/boardwalk empire #phish http://yfrog.com/n4s0whj #

    Post a Comment

    You must be logged in to post a comment.