DeLonghi Espresso Machine Faulty

For Christmas, we bought a DeLonghi Metropolis Espresso machine. I’m pretty happy with the quality of coffee it makes, however it seems to have developed a pretty major fault, since I last used it. The machine has two thermostats, one for heating the plate to the right temperature for brewing coffee, the other for heating to the right temperature for frothing milk. The coffee thermostat seems to be broken, so the machine will not heat up when it’s just in ‘coffee’ mode. I can get the machine to heat up by flicking the switch ‘frothing’ mode, but then I need to be there to turn it off as it gets to the right temperature. I’ll have to get this fixed. The machine is only three months old, and I’ve been taking very good care of it! I’ve sent off an email to DeLonghi customer service. It will be interesting to see how they respond to email.

First Comment Spam in Ages

Well, I got a Comment Spam tonight, and as the title indicates, it’s the first Comment Spam I’ve had since I implemented my Captcha. I know it’s a Comment, not a Trackback, as I have code that discriminates between the two. If I continue to get them, I’ll have to either modify my Comment Spam protection, or look into using the Blogsome one, which I don’t really want to do, as it doesn’t ‘look’ like my site when the page is loaded.

iTunes Random Songs

Here I am listening to iTunes on Party Shuffle, and on comes:

If You Have A Cross To Bear You May As Well Use It As A CrutchMolokoThings To Make And Do ★★

Hang on a bit! I heard this song earlier today. Let’s see when: That selected track is the one I’m listening to, and I last heard it at 12:27pm today. I thought so! And, as you can see, I stopped listening to music at around 2 pm. So, I must have only listened to it about a dozen tracks ago! Okay, so I’m using my Party Shuffle, maybe I’ve only got a small Playlist I’m selecting from. Nope. 6088 tracks. Hang on, I’ve got a playlist showing my Recently Played tracks. Morcheeba has finished now, but I can see how many tracks ago it was since I know the time it played. I heard the same track 25 tracks ago. That means when it first played, it was added immediately to the Party Shuffle again. I’ve read about the randomness of iTunes, but I still love it when something like this happens!

Starfuckers, Inc.Nine Inch NailsTriple J Hottest 100 – Volume 7 ½

Edit/Delete Comment

At times, it’s annoying to have to go into the Dashboard, just to delete a Comment that has appeared, or to Edit a comment I have made (or fix the text of someone else’s comment). Luckily, you can create links or buttons to allow you to do these two jobs while viewing a Post page: ✍ Edit ✗ Delete In your Comments.html template, find the location you want to put the links. To just have the Edit Comment link (you can delete a comment from it’s editing page), insert the following:

1     {edit_comment_link}

To have both an Edit and a Delete link, try the following:

    {capture name=edit_comment}{edit_comment_link link="✍ Edit"}{/capture}
    {if $smarty.capture.edit_comment != ""}
        {$smarty.capture.edit_comment}
        <a href="http://schinckel.net/wp-admin/post.php?action=confirmdeletecomment&comment={comment_ID}">Delete</a>
    {/if}

I have mine all nicely styled, using the following (and some CSS):

    {capture name=edit_comment}{edit_comment_link link="&#9997; Edit" before='<span class="button">' after="</span>"}{/capture}
    {if $smarty.capture.edit_comment != ""}
        <div class="right">
            {$smarty.capture.edit_comment}
            <span class="button"><a href="http://schinckel.net/wp-admin/post.php?action=confirmdeletecomment&comment={comment_ID}">&#10007; Delete</a></span>
        </div>
    {/if}

Displaying Comments awaiting Moderation

It’s a neato feature to be able to show a reader the comment they have just posted, but which is awaiting moderation before it it displayed to everyone else. Newer versions of Wordpress can do this, and many templates also have this feature built in, but it does not work on Blogsome. The code that grabs the Comment data is found, in Blogsome, in wp-inst/wp-comments.php:

1         $query = "SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date";
2         $comments = $wpdb->get_results( $query );

This code was fairly easy to find, but the equivalent code in Wordpress was a bit tricker. Eventually, I found it in wp-includes/comment-functions.php:

 1         if ( is_single() || is_page() || $withcomments ) :
 2             $req = get_settings('require_name_email');
 3             $comment_author = isset($_COOKIE['comment_author_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_'.COOKIEHASH])) : '';
 4             $comment_author_email = isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_email_'.COOKIEHASH])) : '';
 5             $comment_author_url = isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_url_'.COOKIEHASH])) : '';
 6         if ( empty($comment_author) ) {
 7             $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date");
 8         } else {
 9             $author_db = addslashes($comment_author);
10             $email_db  = addslashes($comment_author_email);
11             $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date");
12         }

I had to modify the code somewhat, but here is the code I have put on the private Blogsome test server:

 1         $comment_author = isset($_COOKIE['comment_author_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_'.COOKIEHASH])) : '';
 2         $comment_author_email = isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ? trim(stripslashes($_COOKIE['comment_author_email_'.COOKIEHASH])) : '';
 3         $author_db = addslashes($comment_author);
 4         $email_db  = addslashes($comment_author_email);
 5         if ( empty($comment_author) ) {
 6             $query = "SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND comment_approved = '1' ORDER BY comment_date";
 7             $comments = $wpdb->get_results( $query );
 8         } else {
 9             $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date");
10             $comments = $wpdb->get_results( $query );
11         }

It could probably be tweaked (for instance, moving the addslashes() calls to within the else block would save a couple of CPU cycles when no author is set), but it works!. You need to have the following in your Comments Template:

    {if $comment->comment_approved == "0"}
        <p>Your Comment is awaiting Moderation.</p>
    {/if}

I’m also going to style the comment box a little differently for unmoderated comments.