Archive for March, 02006
Training for Tour de Kota
Saturday, March 18th, 02006Dive into GreaseMonkey and other digg Gold
Friday, March 17th, 02006Digg's got some gold this morning:
History of Programming Languages
Monday, March 13th, 02006I'd like a large print of this chart of programming language history.
Poor man’s Wordpress spam prevention
Sunday, March 12th, 02006Here's are some instructions for adding a "enter special keyword before comment" spam prevention feature like the one I use in my Wordpress installation. There are more sophisticated plugins that may do a better job of preventing comment spam, but this method has the advantage of being dead simple and not requiring any extra libraries.
Instructions for Wordpress 1.5.x and 2.x
- Figure out how to edit your Wordpress PHP files. You can do this with vi on the command line, from whatever file browser / editor you normally use for this kind of thing, or even directly from the Wordpress admin interface in some cases (Presentation / Theme Editor).
- Open up the comments.php file corresponding to your theme and get ready to edit. This could be something like wp-content/themes/default/comments.php, but finding it should be a no-brainer from the Wordpress admin interface.
- Find the code that looks like the following (~ line 104 in my copy of comments.php):
<p><input type="text" name="url" id="url" value="..." size="22" tabindex="3" /> <label for="url"><small>Website</small></label></p>
- Add some code right below this for your new field like this:
<p> <input type="text" name="codeword" id="codeword" value="" size="22" tabindex="4" /> <label for="codeword"> <small> The Answer, to Life, the Universe, and Everything </small> </label> </p>
With the above, we're asking the commenter to give the Answer to Life, the Universe, and Everything (42 according to Deep Thought), before we accept their comment. We're only asking the question at this point. Answer validation comes later.
- Observe your progress. You should have gone from something like:

to something like:

Make sure you log out of Wordpress to view the above changes, because these changes only show up for users who aren't logged in.
- Now we need to validate the answer and prevent comments, if the wrong answer is given. Find your wp-comments-post.php file. This isn't a theme-specific file, so you'll have to use something other than the Wordpress admin interface to edit it. It's usually a top-level file in your Wordpress distribution. Go to the part that says something like:
// If the user is logged in get_currentuserinfo(); if ( $user_ID ) : $comment_author = addslashes($user_identity); $comment_author_email = addslashes($user_email); $comment_author_url = addslashes($user_url); else : if ( get_option('comment_registration') ) die( __('Sorry, you must be logged in to post a comment.') ); endif;This was on ~ line 26 in my copy.
- Change this to look like the following (additions are in bold):
// If the user is logged in get_currentuserinfo(); if ( $user_ID ) : $comment_author = addslashes($user_identity); $comment_author_email = addslashes($user_email); $comment_author_url = addslashes($user_url); else : if ( get_option('comment_registration') ) die( __('Sorry, you must be logged in to post a comment.') ); $answer = '42'; if( trim($_POST['codeword']) != $answer): die( '<p>You failed to provide the Ultimate Answer, to Life, ' . 'the Universe, and Everything.</p>' . '<p>I can only assume you are a spambot. ' . 'If you are not, please go back and try again.' ); endif; endif; - Test things out and celebrate less spam. You'll probably have better luck, if you use a string different than "codeword" in both comments.php and wp-comments-post.php, along with a different question/answer.
Big Snow
Sunday, March 12th, 02006New Jade Plant
Thursday, March 9th, 02006I received a giant jade plant from the father of one of Elisa's friends today. I've repotted it and hope to see it flourish in its new environment:
|
|
Update March 11th - Some very quick (and still not quite right) color correction above plus a photo of most of my jade family and the not (yet) as beautiful backside of the big one below:
|
Chinese Menus Gone Wrong
Thursday, March 9th, 02006Two great tastes that taste great together
Sunday, March 5th, 02006Amusement Parks
Friday, March 3rd, 02006I have never been to a major amusement park. For me, this is a point of pride.
Juniper blooms early
Wednesday, March 1st, 02006The junipers are blooming early and heavy this year. Today's East Side count is 943. This level is very difficult for me.
Anello's graph of East Side juniper
City of Albuquerque's official reading

















