After more than a year of struggling and searching around, I have finally found why the comments on my blog were not working any more.
So the good news for all my readers is this: You can finally comment again!
Since the time I upgraded from MT 4.x to 5.x, the following error message started appearing whenever one attempted to submit comments:
Your comment submission failed for the following reasons: Invalid request.
As it turns out the problem was trivial but extremely difficult to pinpoint. Here's how I figured it out.
I loaded an entry page, activated Firebug, entered some text in the comments field, and hit the submit button. In the Firebug console, there was a javascript error, namely the following:
mtCommentOnSubmit is not defined.
This must mean that mt.js
wasn't being loaded in that page. Indeed, upon inspecting the source code, this file was not present. At the same time, another anomaly caught my eye, namely that the file utils.js
was being loaded twice.
In addition to the standard "JavaScript" template which outputs the mt.js
file, I had created my own user-defined template called "JavaScript Utils" which outputs the utils.js
file.
So far so good you might think. Well, it turns out that the following template tag, which I have defined in the "Header" template, doesn't always render the same output:
<script type="text/javascript" src="<$mt:Link template="javascript"$>"></script>
For some strange reason it normally renders mt.js
, but in the entry page it incorrectly renders utils.js
instead. That's why it was appearing twice, once because of <$mt:Link template="javascript"$>
and then again because of <$mt:Link template="JavaScript Utils"$>
.
The solution is to rename the template="JavaScript Utils"
to template="Javascript-Utils"
and the problem is solved.
Now I expect many new comments to appear as the droves of my visitors are unleashed to share their many ideas with me.
Try it out yourself and see if it works.
Okay so I am testing that the comments work, and as promised in this entry they do.