Posts from — January 2009
Wordpress tip: Move comments from one post to another post
I recently ended up with two posts on this site about the same project — one was a short summary, and the other a long, detailed article. I decided to consolidate them into the longer article, but I didn’t want to lose the six comments that had been posted to the short article.
I couldn’t find a way in the Wordpress UI to move comments from one post to another, so I jumped into the database. If you run Wordpress on a host, they probably provide a MySQL management tool like PHPMyAdmin, or you can log in with a mysql client.
First, find the table that contains the posts for your blog (the table name usually ends in _posts). Find the ID that matches the post you want to move comments from, and the ID for the post that you want to move comments to.
Note: An easy way to do this is to search by the post title. If you need to write the SQL by hand, use something like this:
SELECT * FROM wp_posts WHERE post_title LIKE '%posttitlekeyword%';
Replace wp_posts with the name of the database table containing your posts, and posttitlekeyword with a relatively unique keyword or phrase from the title of your post.
Second, switch to the comments table. Each comment is linked to a particular post by the ID in the comment_post_ID field. You want to switch all of the entries that point to the ID for the first post to the ID for the second post. You can do this in a visual interface by searching for the relevant comments and updating them one by one, or using this SQL:
UPDATE wp_comments SET comment_post_id=2 WHERE comment_post_id=1;
Change 1 to the ID of the original post and 2 to the ID of the post you want to move the comments to.
Note: You are making changes to your Wordpress database! If things go awry, you could lose your data. Make sure you have a robust backup strategy before you attempt to change anything.
January 31, 2009 3 Comments
Twitter: A greasemonkey script to show who follows you
A couple of days ago I saw @skap5’s comment:
“Dear Twitter Is it too much to ask to add a follower marker so I can know if someone is following me and not just if I am following them?”
I think that Twitter could benefit from displaying more information on the home page, and this idea was easy enough to code up. It should save some time and make the Twitter homepage that much more useful.
The script displays a tiny icon on top of the portrait of people who are following you back on your Twitter home page. It leaves your non-followers alone, though it would be easy enough to develop a version that puts silly mustaches on them.
This is only a first version, and I welcome your comments and suggestions.
If you already have Greasemonkey installed, get the script here, or install it from here as a Firefox extension thanks to the script compiler.
The icon is a free icon courtesy of famfamfam.
Updated February 5, 2009: The script has been updated to work with Twitter’s recent UI changes.
Updated March 31, 2009: The script has been updated to account for Twitter’s recent UI changes and the addition of AJAX updates.
January 1, 2009 9 Comments




