WordPress / Dreamhost Comment Problem.
November 30th, 2006 by Lynx
So you’ve set up a blog, made it look great then BAM, people report problems posting comments. You test the comments part of the site and it all works great for you, furthermore, other people have left comments so whats the problem?
Well, some people keep getting the following screen whenever they try and post:
Now I’ve had my fair share of compatibility problems running a flash website so my first thought was a dodgy browser. I tested in IE 6+7 and in Firefox 1+2 and I could comment fine – yet I was getting reports of both IE and Firefox not being able to post.
This left the only option being firewalls. Some people must have their firewalls set too high, but so what? Why shouldn’t you be able to have a secure firewall and post comments on a blog? It didnt make sense so I did some digging and found this little gem from my hosts at Dreamhost:
“Finally, we have put a tiny little hack of our own in the wp-comments-post.php and wp-comments-popup.php files to try and prevent automated comment spam a bit. If you end up never getting any comment spam, it may be that that little hack was enough!”
OH REALLY!
Cut a long story short it is this ‘tiny little hack’ that stops some people from being able to post comments. So if you use Word Press and host it on Dreamhost and are getting reports of the ‘Error: This file cannot be used on its own.’ this is how you fix it:
-
Go to http://www.dreamhost.com/Â and login
-
Click on ‘Domains’ and then ‘Manage Domains’
-
Click on the ‘WebFTP’ for the domain your blog.
-
Click on the Folder you saved your WordPress installation to, for me it was ‘blog2’.
-
In here you’ll see a ‘wp-comments-popup.php’ – click on the edit button and you’ll see:
-
if (!$_SERVER[‘HTTP_REFERER’] == dirname(__FILE__) . ‘/wp-comments.php’)
{
die (‘Error: This file cannot be used on its own.’);
} -
Comment these lines out using // before each line and click the Save button (a floppy disk icon).
-
If you go back and then ‘view’ this same file all the writing should be in grey meaning it isn’t being used.
-
At the top of the ‘wp-comments-post.php’ file you’ll see the same 4 lines of code. Put // at the beggining of each so they’re not used and save.
-
Congratulations, your readers can now comment on your blog – yes, all of them.
I emailed Dreamhost about this to begin with and they just pointed me in the direction of the Word Press Forums. I’m not sure if they do this because they don’t know or don’t want to admit they have messed up. I’m sure their intentions were good for doing this (because they didn’t have to), but the fix they have put in place stops some people with tight firewall settings from posting comments. This, in my opinion, is a big enough bug to warrant removing this fix and finding a better way to stop comment spam.
Sorry Dreamhost, but in this case it’s, Thanks, but no Thanks.
(PS a big shoutout to Iceman and Geraint who helped test the fixes.)
No comments yet.