There was a user in the #wordpress IRC channel who was having some problems with his database’s comment_count field being incorrectly updated when deleting comments.
Since there were several of us who weren’t sure if their comment_counts had been properly updated when the field was added, I whipped up a series of SQL queries. There was a good bit of playing around, but the final version is:
SELECT id, comment_count
FROM wp_posts p
WHERE p.comment_count >0
AND (
id, comment_count
) NOT
IN (
SELECT comment_post_id, count( * )
FROM wp_comments c
WHERE comment_approved = '1'
GROUP BY comment_post_id
)
Of course update wp_ with whatever your database prefix is, assuming you didn’t use the default.
Updating these values should be about as simple, although I have not tested this:
update wp_posts p
set p.comment_count = (
select count(*) from wp_comments where comment_post_id = p.id and comment_approved = '1'
)
Anyone who’s ever tried it knows that the search functionality on the Wordpress Codex sucks horribly. In #wordpress, we have a bot that utilizes the Google site: query attribute to search Google’s listings for the codex, but sometimes you want to be able to search from your own web browser, not by going through an IRC bot.
Since typing in site:codex.wordpress.org gets boring fast, I decided to throw together a quick Google Co-Op search engine a while back that utilizes the Google index of the Codex, as well as a handful of other sites I’ve found with helpful Wordpress-related documentation (like the API Hooks list).
So if you’re interested, check out the Wordpress Documentation Search, powered by Google Co-Op.
If you’re a fellow Wordpress-lover and know of any good sites that should be included in the documentation, please feel free to volunteer! Remember that Google Co-Op will let you specify full sites, url patterns, or even specific individual pages, so even if you find a random blog entry that contains information you’ve found helpful, please add it to the list. If you don’t feel like volunteering directly, you can also just tack a comment on here about your favorite source for Wordpress documentation and hackery and I’ll add them to the list.
Here’s to better searching and learning through Google tools!
It’s a Non-RIAA Kind of Thing…
While Gizmodo is advocating that we “Put Our Money Where Our Mouths Are” and boycott the RIAA in March (an idea I fully support, and which Digg users obviously love), I was shocked at the number of popular records published by RIAA members.
I knew they were powerful, but I had no idea it was this bad.
Check out the RIAA Radar’s Amazon Top Albums list. How many green “Safe” tags do you see on that page? Far too few…
I was looking at The Killers’ Sam’s Town album, and decided to see what RIAA Radar recommended as RIAA-safe alternatives to The Killers. Much to my surprise, there are a number of excellent bands available through non-RIAA labels: Gnarls Barkley, The Postal Service, Snow Patrol, Death Cab for Cutie, Barenaked Ladies, Damien Rice, Gym Class Heroes, Arctic Monkeys, Panic! At The Disco, Buckcherry, Solomon Burke, The Shins - all quite popular non-RIAA label alternatives.
With all these popular “safe” alternatives, why wouldn’t you want to boycott the RIAA for a month? It’s not like you have to do without decent music for the month… Use the month of March as not only a month to show the RIAA you’re angry at them, but also as a month to find some new non-RIAA music that’s just as good and support some of the smaller non-RIAA labels and groups while you’re at it.
Stunt RIAA sales and show labels that they don’t need to join the RIAA to make money at the same time, all while enjoying some excellent music. What’s not to love?
Need some help staying RIAA-safe in March? Check out the RIAA Radar’s bookmarklets, just to make sure you don’t stray from the path while shopping. And while you’re finding great non-RIAA music, be sure to let others know about it by blogging about your favorite artists and commenting on Digg, Gizmodo, and other stories about the boycott. While you’re at it, drop a quick comment here about an artist you’ve found that you like on a RIAA-free label - I’m always looking for more music!
Now get out there and do it!
Update: For more quality RIAA-related babble from me, check out my previous blog entry: Oh No, Could the RIAA actually be Wrong?!