TwitterCommenters Plugin and the "Can't call method 'permalink' on an undefined value" Error

| 1 Comment | No TrackBacks |
I have recently installed the TwitterCommenters plugin on this site, meaning you can now leave a comment using your Twitter username and password.  However, if you just install this plugin on a plain Movable Type installation you are likely to get an error message that reads "Can't call method 'permalink' on an undefined value", even if you followed the installation instructions to the letter.
The solution to fixing this is found in this comment on the TwitterCommenters home page.  Under 'Design > Templates', open your 'JavaScript' template and look for the definition of the mtSignIn function.  Then replace it with this definition and save/republish your blog:

function mtSignIn({
    var doc_url document.URL;
    doc_url doc_url.replace(/#.+/'');
    var url '<$mt:SignInLink$>';
    if (is_preview{
        if document['comments_form'{
            var entry_id document['comments_form'].entry_id.value;
            url += '&entry_id=' entry_id;
        else {
            url += '&return_url=<$mt:BlogURL encode_url="1"$>';
        }
    else {
if document['comments_form'{
var entry_id document['comments_form'].entry_id.value;
url += '&entry_id=' entry_id;
}
url += '&return_url=' encodeURIComponent(doc_url '#commentform');    }
    mtClearUser();
    location.href url;
}

The actual reason for the error is that the 'old' mtSignIn wasn't passing on the entry_id of the entry a visitor was trying to sign in from, and the TwitterCommenters plugin needed this info to be able to load the entry and get its permalink so it could redirect the visitor back to it after logging in at Twitter.

(I suspect this is because the plugin was probably developed for Melody, a fork of Movable Type, which probably has a different default mtSignIn function.)

No TrackBacks

TrackBack URL: http://www.movabletips.com/cgi-bin/mt/mt-tb.cgi/73

1 Comment

This comment was made using my Twitter authentication data!

Leave a comment


Movable Type Help?

"Can my Movable Type issue or project be taken care of by a professional?" Yes It Can Be! Contact YesItCan.be
Powered by Movable Type 5.2.7