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-03-05 | YEMblog
    • Thanks to @CoventryMusic for the great commentary on tonight's #trey show and @tweeprise for the killer twitpics #phish #
    • Acoustic Trey in LA: Chalkdust, Bathtub Gin, Prince Caspian, Theme, Joy, Cavern, #Line [via @CoventryMusic] #trey #phish #
    • Follow Friday – Rumor/Speculation Free Phishy Feeds: @ericwyman @phishtwit @cdirksen @trey_talks @phishphans @phishnet #ff #phish #
    • Reminder, Pauly from @CoventryMusic will be tweeting from tonight's show, so if you want #trey updates follow him #phish #
    • Pauly will provide updates from tonight's show @CoventryMusic #trey #la #
    • @JeffPicanso What I meant to say is that Mike and Fish worked elements of 2001 into that Split from 7/15/99 and did it again on 7/26/99 #
    • Reminder to get your Trey Tour Pick Three picks in for tonight's show in LA http://www.facebook.com/yemblog Will anyone be tweeting tonight? #
    • @ChinaKatSunflwr Ha! That setlist is RELENTLESS and even songs like Rift were played with aplomb that night (re: 3/20/92) #
    • Did you hit the Greek shows last summer? Can only imagine the differences 17 years between shows at the venue RT: @kjrahimi 8/28/93 Berkeley #
    • The Fluff, Antelope and Hood are all standout versions. I blame the painkillers ;) RT: @lastubbe 2nd show 4/10/94 #trey fell in a hole #
    • It's almost like that first set was a continuation of the Burgettstown madness RT: @peteforgets my 2nd show was 7/30/03 camden 1 #
    • If folks haven't heard 3/20/92 MAKE IT YOUR BUSINESS. Be sure to check out the "alternate" Rift solo. 60 seconds of magic #phish #
    • I'm so jealous. Agreed on its greatness. Best Rift ever x10,000 RT: @neddyo 2nd is still one of my all time greats: 3/20/92 Binghamton #
    • @neddyo I was writing Binghampton until two weeks ago when @phishnquips corrected me. Never knew there was no P! #
    • I disagree on both accounts, but that's what makes horse racing RT: @jbanks79 12/2/95 Overrated Tweezer, entire show completely underrated #
    • This seems to be a popular 2nd show for many RT: @adamicculus My 2nd show was 7/8/94 #JesusChristSuperStar #
    • Talk about mashups RT: @sidewinder13 2nd show "Starwood Veranda" Allison Krauss on IfIcould + Harpua(sunshineofyourlove/SunshineofmyLife) #
    • That was the 2001/Split mashup if memory serves RT: @JeffPicanso Long bizarre Split freakout jam in Set II. #
    • That was the only show my mom has seen. Luckily my sis took her home at setbreak RT: @JeffPicanso 7/15/99 Great Ghost & YEM in Set 1 #
    • I had a blast at that show. I've gotta check out that Jim, don't know if I've heard it since RT: @PeteLikesMusic My 2nd show was 7/3/00 #
    • Gonna go back to the 2nd Show Friday Conversation now that I put in some time at my real job #
    • Tons of errors, but still a decent article on @shapsio and David Lemieux @ Drexel http://bit.ly/g9KGKY #phish #
    • This one ain't free, but this @mike_gordon show w/ fish on drums looks fabulous http://bit.ly/ghx42R [via @deuce2_420] #phish #cactus #
    • Lots of great new Phish content on the web today http://yemblog.com Tiered Pricing debate, DGB's Biondo interview, 7/31/97 remaster & more #
    • Talk about underrated, check out this video playlist of 7/31/03 w/ fantastic versions of Piper, Mike's and Hood http://bit.ly/hCiVMA #phish #
    • What happens if you mix the intro from the Providence Rock and Roll w/ the jam from NYE? http://bit.ly/gfLNdz #phish #
    • Love it! Dear Trey, bust out Izabella and Eliza for ur kids RT: @pinkriverdolphn 12/12/97 let's just say oneofmy daughters is named Izabella #
    • Plus the Rupp Gin!!! Must-listen status RT: @jmb110 Show 2= 11/7/96 Rupp Arena. 4 song second set incl Bike w/ 1st vacuum solo and 1st YEM! #
    • What was the crowd like at that show? The Marquee, correct? RT: @matthewwetmore 1991-02-16 NYC a good 2nd before my Arrowhead 3-4 #phish #
    • Y'all rule for taking part in our weekly convos. Always fun talking #phish w/ diehard fans. For those who know how to use it, Twitter rules #
    • What a night! RT: @marshbirder 12/29/95 Worcester Gin>Real Me>Gin, McGrupp, LaGrange, bass duet. Enough said! #
    • I love the transition from Ramble On -> Slave, one of my faves RT: @sliderock9 My 2nd show was Vernon Downs 8/12/98 #
    • Phish pissed in your ears at show #2 and you went back for #3 ? ;) RT: @ohkeepahblog 8/10/97 Deer Creek – 4 song second set and rotation jam #
    • You can hear it on the ALO Wilson RT: @tom_volk #2 was 12/30/94. To this day the most intensely raucous crowd through I have heard #
    • Hated it at the time, LOVE it now RT: @PeterLavetsky 8/14/96 Hershey, PA Seems to swing back & forth between overrated / hated & underrated #
    • Jealous! Always wanted to see Page sing that one RT: @aaronjhawley 8/13/97 Amoreena! #
    • Crazy to go to #phish fest for show #2 RT: @Poster_Nutbag Great Went! @phanart Lemonwheel #
    • Not at all. My fav of that run RT: @DanMar85 My 2nd show was 12/1/03. Appearneces by Jeff Holdsworth & Tom Marshall. Not bad for a 2.0er. #
    • Great Hood, too. Look for more on that soon CC: @GuyForgetOPT RT: @dvgmacdonald Oct. 94 Gainesville, FL Purple Rain & Coil Enc #
    • Cannot visualize seeing Phish at that place. Was dinner included? RT: @prescribed_ club bene 10-7-90 read icculus but didnt know at the time #
    • Quite a show for #2 One of my all-time faves RT: @apple0229 Got a Purple Rain at my 2nd show 7/25/99 Deer Creek #
    • Everyone talks about how bad that show is. Haven't listened since that night but don't remember it sucking RT: @Curtis_ILM 6/25/2000 #
    • Love it! Great show besides GHendge RT: @GlobeEricWilbur I witnessed a little thing called Gamehendge. No biggie. #
    • Me: 10/07/1994 – Stabler Arena, Lehigh PA; good show for a newcomer. Crowd gave band standing O after debut of Guyute Underrated Reba #phish #
    • Friday Convo: Everyone always talks about their 1st show. We want to know about your second show. Where, when and how was it? #phish #
    • @RunawayJimPVD It's in the second sentence of the article and the first word of my last tweet (a re-tweet) was "Free" :) #
    • Why should you download @mike_gordon's new SBD recording of 11/16/10? HT lists a few highlights from a previous review http://bit.ly/gzpaRf #

    Post a Comment

    You must be logged in to post a comment.