Few WordPress-related improvements
In wordpress database, column comment_status is of type enum(’open’, ‘closed’, ‘registered_only’). But for some reason, ‘registered_only’ is never used anywhere…
I use disable comments plugin, which is excellent because it is very simple. Here is the relevant part:
SET comment_status = "closed", ping_status = "closed"
WHERE DATEDIFF(NOW(), post_date) > ‘ . $days);
And if you want it to set the comments to registered_only, you only need to change it to:
SET comment_status = "registered_only", ping_status = "closed"
WHERE DATEDIFF(NOW(), post_date) > ‘ . $days);
Well… now if only ‘registered only’ did what it was supposed to, you’d be done with it. But as it doesn’t, we need to change some things. They are dependent on the theme you’re using, I’ll use the default theme to illustrate what needs to be changed. First, look into comments.php file for something this:
and change it to:
|| ‘registered_only’ == $post->comment_status)
In the default theme, this needed to be changed at two places.
Then there’s one more thing:
should be changed to:
|| (‘registered_only’ == $post->comment_status)) && !$user_ID)
After that, it pretty much works. You need to have user registration enabled in wordpress, though. Also, while I was at it, I decided to prevent against bots registering. So I installed Sabre. Sabre is nice, but its CAPTCHA rather sucks… well, anyway — more on that in the next post. 
Posted on 2008-01-19 at 1:44 pm, filed under internet, programming. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.


