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-24 | YEMblog
    • Thanks ScottyB for all you do. Signing off to seek out deep fried chicken appendages covered in hot sauce. Please address hate to @CGlush #
    • #phish 10-23-10 II dwd mfmf caspian halfway to the moon boogie on maze wading piper hood yem e: shine a light
      http://tinyurl.com/2c66nhn #
    • Fun show as they all are. Still, I'd be lying if I said this wasn't one of the weaker showings of Fall. Great to hear the boys as always. #
    • End of show #
    • E Shine a Light #
    • End of set #
    • Rest of the YEM was excellent for a 3.0 YEM. Trey tried teasing Wilson but only about 10% of the crowd caught on so they aborted. #
    • The bass solo Mike just took was up there with the best I've seen. #
    • @BrianBavosa from my view in the seats, it looks like an Indy-rock crowd out there. in reply to BrianBavosa #
    • Great Hood. So awesome to hear them put so much care into that tune again. #
    • YEM!!! #
    • They've been playing some stellar Hoods in 2010 (Greek, JB and Augusta). This should hopefully be interesting. #
    • Piper lasted about 8 min. It WAS sounding quite good before the bail into Hood. #
    • Hood #
    • Piper so far is easily the best they've played tonight. 6 min in and getting very interesting. #
    • Piper!!!! #
    • We really need a Ghost to come flying in wearing a red cape with an "S" on it's chest. #
    • Maze ripped (as they all do) – nothing out of the ordinary. Clocked in just under 10 min. #
    • Velvet Sea #
    • This may be the fewest people I've seen dancing at a Phish show. Maybe the lack off beer has something to do with it? #
    • #phish 10-23-10 II dwd mfmf caspian halfway to the moon boogie on maze http://tinyurl.com/2c66nhn #
    • Standard, groovy fun Boogie On (no leads by Trey). Clocked in around 5:30. #
    • Maze #
    • That woke the crowd up. Break out your dancin shoes, kids. #
    • Great segue into BOOGIE ON! #
    • New page tune – Halfway to the Moon #
    • Lovely quiet interplay at the end of the Caspian. Now sounds akin to the GD's Spanish Jam #
    • #phish 10-23-10 II dwd mfmf caspian http://tinyurl.com/2c66nhn #
    • Caspian #
    • Set II Disease > My Friend My Friend #
    • Sorry, too much Utica on the brain. #
    • Fuck. My Friend My Friend. Not Guyute. #
    • Disease clocked in just under 13 min. It was interesting but not even in the top 3/4 of second set Diseases this year. #
    • Guyute #
    • Disease is hitting some interesting places – #
    • Last night's Disease was jam-free. Lets hope this one takes off. #
    • We're back, sports fans. Disease (again). Weird. #
    • Hats off to the Mullins for a plethora of cheap, quality food options. But I'd trade them all for one expensive, generic beer option. #
    • Btw, would anyone object to Tweeprise played every show, perhaps multiple times per show? #
    • Lots of effort by the boys, but the magic of the last few nights wasn't there. Something tells me that will change for set 2. #
    • #phish 10-23-10 meatstick party time golgi kdf tweezer lawnboy sparkle bbfcfm hyhu>love you>hyhu possum rp http://tinyurl.com/2c66nhn #
    • End of set. Trey closed with "we'll be back in exactly 15 minutes" I haves heard that in a while. #
    • Trey screaming Meatstick lyrics over Tweeprise. Place going nuts! #
    • Tweeprise!!!! #
    • Possum was possum. We've all heard it before. #
    • Possum #
    • Woman in front of me just said "I paid money for this!" #priceless #
    • #phish 10-23-10 meatstick party time golgi kdf tweezer lawnboy sparkle bbfcfm hyhu>love you http://tinyurl.com/2c66nhn #
    • I've been told this is the first HYHU of 2010. #
    • Love ya (syd Barrett) #
    • Trey was shaking his hands out after BBFCFM. SSeems like he needed a breather. #
    • With vacuum. #
    • HYHU – Fish coming out #
    • BBFCFM #
    • FASTEST SPARKLE EVER! #
    • Best part of Sparkle – it always bangs into a winner. Worst part – not enough time to pee. (I kid) #
    • Sparkle #
    • Tweezer clocked in a little over 13 min. Great to hear but far from a standout, even a little boring, probably a C- on the @cdirksen scale #
    • #phish umass night 1 meatstick party time golgi kdf tweezer lawnboy http://tinyurl.com/2c66nhn #
    • Lawn Boy #
    • Lawn Bou #
    • Tweezer closing old school style back into the main riff, slowed down little by little. #
    • No real themes so far. Tweezer seems to be losing the crowd. #
    • Very methodical build so far. #
    • KDF clocked in just under 9 min. Had potential but ended up pretty standard. But who cares. THEY JUST DROPPED A FIRST SET TWEEZER! #GameOn #
    • Tweezer!!! #
    • Golgi was the golgiest version ever. #
    • Golgi #
    • Kill devil fall #
    • #phish umass night 1 meatstick party time golgi http://tinyurl.com/2c66nhn #
    • Btw, band came out with some sheets of paper. That's usually the sign of an impending rarity or new song. #fingerscrossed #
    • Party time clocked in around 6:20. One of the better versions as Trey ripped a sweet solo in the middle. #
    • "happy birthday Kevin?" in the Party Time. Solid way to kick off the night. #
    • Meatstick was about 5.5 min, nothing special in the jam but a very fun opener. Mike is way turned up in the mix compared to last night. #PLM #
    • Party Time! #
    • Fans need to brush up on the Meatstick dance. And Japanese lyrics. #
    • Venue has very few seats head on so Kuroda seems to be using the wall behind him as a canvas as well. Not sure if it's intentional. #
    • Great opener – energy is off the hook #
    • HERE WE GO! Meatstick #
    • …We'll focus on what's played & how it's played vs other versions. No negativity, but don't expect fluffing either #KeepItRealDog #
    • Ps – don't expect any deep musical dissection from me. I can't even play the recorder but I've listened to way too much Phish in my life… #
    • Buckle up, sports fans. Garry Brown and Kuroda are in position. We should start in 15 or so. #Jamherst #
    • Mullins Center sells Legal Seafood chowder inside the venue. I know what I'll be doing during TTE. #phish #Jamherst #
    • Make #Jamherst happen. Stop writing songs on balloons & signs. Just write "JAM." You'll thank me later. #phish #PeopleForLongerJams #
    • Reminder, opinions expressed 2nite are from @CGlush – a cranky old fan w/ an overwhelming desire for long, devastating jams #5SongSet #phish #
    • Important news for Jamherst #phish attendees. Wings Over Amherst will deliver until 2:30am. You can thank me later. http://j.mp/bm7ItD #
    • Gorgeous day here at Umass, perfect Fall Tour weather. Ps – 12/5/95 Amherst = Best.Hood.Ever. I'll post link from @CGlush tomorrow #phish :) #
    • FYI – if you think the line for posters is bad, try checking into the Campus Center Hotel. Be prepared if you are staying there. #phish #
    • If Utica can get Guyutica, we can get Jamherst. Make your "Jamherst" and "Jam" signs and balloons now. Also suggested: "5 song set" #phish #
    • For those looking for a bite and brew in Jamherst, the Jamherst Brewing Co has some Phishy specials and delicious smoked porter #phish #
    • Reminder: @CGlush will be tweeting from tonight's show in Amherst for us. Safe travels, everybody #
    • Today on YEMblog: Providence audio, videos and reviews plus Mike Moss Remixes and much more http://yemblog.com #phish #
    • @tubegal You try coordinating capable people to tweet from a 17-show tour and we'll see how you do #

    Post a Comment

    You must be logged in to post a comment.