I’ve never actually thought much about trashed posts before today…
I like the looks of the Disqus plugin for WordPress. In fact, I like the whole look of the Disqus idea. Why shouldn’t all my comments be lumped under one ID? Why should other people have to log into my site just to leave valid posts? Can’t we make this simpler? It hasn’t been updated in a while, I hope it doesn’t have any bugs. So I Installed the Disqus plugin on my version 3+ WordPress platform.
What’s this post-trashed thing?
I didn’t notice the bug at first; it only popped up on the dashboard, and it was under the wordpress admin bar. But there it was, peeking out.
Notice: Undefined index: post-trashed in /data/16/2/86/4/2575493/user/2823750/htdocs/wp-content/plugins/disqus-comment-system/disqus.php on line 908
Since I wasn’t working on my tractor, due to some afternoon rain, and heady from my success with SharePoint at work, I decided to pop the hood of the Disqus plugin and see what was up. So I fired up Microsoft WebMatrix and loaded the php file.
Line 894 tells it all:
// taken from wp-includes/comment.php – WP 2.8.5
Crap. The plugin isn’t fully compatible with the new WP 3.x. So I opened the new comment.php file in WebMatrix and found the errant line.
Line 906 in the core comment.php file changed to add a bunch of extra values to relay post status to admins. It adds the trash and post-trashed values.
$approved = array(’0′ => ‘moderated’, ’1′ => ‘approved’, ‘spam’ => ‘spam’, ‘trash’ => ‘trash’, ‘post-trashed’ => ‘post-trashed’);
OMG! What’s the fix?
Pasting the preceding into the disqus.php file, over line 903 seems to fix the issue. The error message no longer pops up. However, I can’t be certain if the comment counting is correct. I think it may be off, since the 3.x core file has code excluding posts marked as “post-trashed.” I’ll have to play with it when I have more time in WebMatrix, then add the final solution to my plugin file.
In the mean time, it looks like Disqus has some updating to do.