December 16, 2004

TypeKey Authentication for Comments

Originally posted 9-28-04.

The ability to leave comments on other people's weblogs and accept comments on your own is one of the features that make blogs so compelling. Accepting comments on your blog however, can be like having an open house party where ill-behaved uninvited guests show up. TypeKey, a free service from Six Apart, can help you control who gets to comment on your weblog.

If you are setting up a new weblog in MT3.x, adding Typekey authentication is easy. You'll need to get a TypeKey token from and select various comment settings in your weblog config preferences. If you have upgraded to MT3 from an earlier version of Movable Type and want to use TypeKey authentication on an existing weblog, that is quite a bit trickier. In addition to the steps already mentioned, you'll need to make several adjustments to your templates. If you are using MT2.661 or an earlier version of Movable Type, you'll have to upgrade to MT3 first, before you can take advantage of TypeKey.

1. Getting set up with TypeKey.

When you downloaded MT3, you registered with TypeKey to get your download. Use the username and password you used to get your MT3 download to log into your account at If you forgot your name and password, you can use your email address to recover your account information.

On your TypeKey Account Preferences page, near the bottom of the page is your Weblog Preferences. Your TypeKey token is displayed there. Copy this token someplace where you can find it later when you go to turn on TypeKey on your weblog. On your TypeKey Account Preferences page, write in the domain URL of your website in your Weblog Preferences section. You'll need to use the domain name (not with the directory) where MT is installed, followed by a trailing slash. For example, if the URL the shows the location of your mt.cgi file is:

then in TypeKey Account Preferences you would type:

Save the changes and exit TypeKey.

2. Selecting the level of comment authentication and moderation you want.

(click to view)

In your Movable Type weblog's Weblog Config Preferences page, there is a section on Comment Configuration. The set-up shown in the pop-up window shows a typical default setting. These boxes checked as shown allow anyone to comment on your site as long as they give name and email information.

If you select Enable Unregistered Comment Moderation then all comments from people who have not registered with TypeKey will have to have their comments approved by you first, before the comments will post publicly. Requiring moderation is the highest degree of control you can have on your comments.

If you would like to moderate unregistered comments, but let those who have signed in with TypeKey have their comments post immediately, without your checking of the comments first, then check Accept Comments from Registered Visitors and the Automatically Approve Registered Commenters.

If you only want to accept comments from people who have logged in with TypeKey, and allow no unregistered comments, uncheck Accept Comments from Unregistered Visitors and select Accept Comments from Registered Visitors. If you want to approve of a comment the first time a registered user comments on your weblog, letting them make subsequent comments without moderation, make sure Automatically Approve Registered Commenters is unchecked.

I recommend checking the E-mail New Comments box in the comments section of your weblog config preferences. This way you'll know if someone posts a spam comment to your weblog that the Blacklist hasn't caught.

Save your configuration settings. If this is a new MT3 weblog, you can rebuild your site. If you have upgraded your weblog to MT3 from an earlier version of Movable Type, hold off on rebuilding the site; you have several more changes to make.

If you have a new MT3 weblog, skip ahead to step 4 to turn on TypeKey.

3. Setting up TypeKey if you have upgraded to MT3

If you have upgraded to MT3 from MT2.661, in addition to the steps listed above you need to make several adjustments to different templates.

a. Bring your comments inline.

In the default MT2.661 templates, the MT main index template links to a comment popup script with the Comments (n) link. Find the code in your Main Index template that invokes the comment popup:

<a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false">Comments (<$MTEntryCommentCount$>)</a>

Replace that code with the following:

<a href="<$MTEntryPermalink$>#comments">Comments (<$MTEntryCommentCount$>)</a>

and link to the comments section of the individual entry. Make sure you have selected Individual Archive Type as a preferred archive type in you Weblog Configuration Archive Files section.

You can also remove the Javascript at the top of the Main Index template that invokes the comment popup.

function OpenComments (c) {, 'comments', 'width=480,height=480,scrollbars=yes,status=yes'); }

Save and rebuild your Main Index Template.

b. Changes to the Individual Entry Archive Template

First, make a copy of your Individual Entry Archive template. That way, if something goes wrong you can easily replace your original code.

Start at the top. Replace the entire Javascript cookie section, including setCookie, getCookie, deleteCookie, fixDate, rememberMe, and forgetMe with the new Javascript section covering the same functions from the new MT3 Individual Entry Archive template listed on the Movable Type default templates page.

Next you need to replace all of the code between <MTComments> and </MTComments> and all of the code between <MTEntryIfCommentsOpen> and </MTEntryIfCommentsOpen> with new code from between those same tags from the new MT3 Individual Entry Archive template.

If you have upgraded to MT3 from MT2.661, and you have not changed your template code to reflect the new MT3 div and class tags, the new comment code in the MT3 templates is going to make your entry page look weird as your stylesheet doesn't recognize the new div and class tags. Donald over at Anzi Design has put together an extensive tutorial on migrating your MT2.x blog to MT3. Around two thirds down the tutorial page, there is a whole section of replacement code for both the <MTComments> and the <MTEntryIfCommentsOpen> sections. I have used this code to replace sections in my MT2.661 formatted blogs and they work fine. I suggest this course if your templates still reflect the MT2.661 id and class tags.

Save your template.

c. Adjust the Comment Pending, Comment Preview, and Comment Error templates.

The upgrade process from MT2.661 to MT3 should have created and populated a new template, the Comment Pending template. Check to make sure. If the Comment Pending template is empty, go to Movable Type default templates page to copy and paste the appropriate code into your template file.

The new Comment Pending, Comment Preview, and Comment Error templates that have the code in them that incorporate Typekey are all using MT3 default div and style tags.

If you are using a stylesheet that reflects MT3 div id and class tags, you can go ahead and copy and paste the Comment Preview and Comment Error templates from Movable Type default templates page into your templates, overriding what is already there.

If you upgraded your MT2.661 weblog without changing your template and stylesheet to reflect the new div IDs and classes, when you copy and paste the new comment templates, over-riding your existing templates, the resulting pages will not render with the correct style. What to do? You can either 1. copy and paste the new templates from Movable Type replacing your existing comment templates, then comb through the code and replace the MT3 ID and class tags with the MT2.661 ID and class tags or 2. figure out what are the additional elements in the new templates and add those to your existing comment templates. Because I have made no changes to my 2.661 weblog comment templates, it's a lot easier to just copy over the new templates and change the div and style tags. (The Anzi Design tutorial also has a section on the comment templates, which shows what to do if you are using MT2.661 tags.)

Save your templates.

d. Make adjustments to your stylesheet.

If you changed your MT2.661 weblog's stylesheet to reflect the new MT3 tags, you may still be missing a couple of elements to make your comments section look like it should. Check your stylesheet. If it does not have the following elements, add them.

#comment-data { float: left; width: 180px; padding-right: 15px; margin-right: 15px; text-align: left; border-right: 1px dotted #BBB; }

textarea[id="comment-text"] {
width: 80%;

.commenter-profile img {
vertical-align: middle;
border-width: 0;

Save your template.

4. Set up Remote Authentication.

On the Main Menu for MT, open your user profile and enter your TypeKey site token and the TypeKey username. Save your profile.

5. Turn on TypeKey.

To go live with TypeKey, take the TypeKey token you copied in Step 1 and paste it into your Weblog Config Preferences Comments section like so (using your own unique token, not the fake one shown):


You may need to first select Accept Comments from Registered Visitors to see the Typekey Token window.

Save your preferences and rebuild your site.

Six Apart's Tutorial on Typekey
Anzi Design - Migrating your MT2.x blog to MT3
Examining the template changes - useful advice from the MT knowledge base. You must have a paid installation to access the knowledge base.
MT Manual section on Comment Configuration
MT Manual Section on Comment Moderation
Still want comment popups in MT3 with TypeKey? It's a bit complicated, but Tweezerman shows the way in this MT Forums thread.

Has this tutorial been helpful? Please consider linking to Learning Movable Type at . Thanks!

Posted by Elise Bauer on December 16, 2004 to Comments and Trackbacks
Comments(16) | Email to a friend | Printer-friendly version


If you would like to send a trackback
please use the following URL:

» MovableType updates from Davison Online
Having had more than enough of comment and trackback spam, I've fully integrated the spam blocking features of MovableType 3.121. This includes the use of the TypeKey registration system, which means anyone who wishes can sign up for the free......[read more]

Tracked: May 15, 2005 03:56 PM


I attempted to print out your tutorial, but it won't go beyond Step 2 where you have a click-to-view box. Even in Print Preview it only displays one page. I'm using FireFox 0.9, perhaps it's not an issue on IE. Anyway, your tutorial is very helpful.

Hi Ken,

I don't know what might be causing that, it works fine on Mac Safari. Have you tried the latest version of Firefox?

This tutorial should be part of the docs. The upgrade was far more painful than it needed to be.

I appreciate the tutorial and have followed it, but still no joy. This has to be one of the hardest componenets of the new MT system to get one's head around. Thanks.

I'm having a hard time figuring out which style tags manipulating the text of the comments on my archive pages. I implemented your upgrade instructions and the TypeKey login works like a charm. I only need to get the comments text and styles to fall in line with the rest of my site. Would this be contained in the two sections added to the stylesheet?


I figured it out. It was quite simple actually. I wasn't applying the tag to the variable in the individual archive template. Now that I have done this, the comments look as I would expect them.

Thanks again for a great tutorial.

Thanks for heaps of neat tips - today it was getting rid of the border around the TypeKey image that brought me here! :)

this was VERY helpful. thanks.

i'm having the same problem i see on the boards, though, with getting typekey to recognize my site.

at least commenting here i get to see how it's supposed to work!

not sure where i've gone wrong, but i'll keep looking.

Don't forget to also enter your typekey on the Main Page/Edit your profile. It needs to be in there for Remote Authentication too. Thanks for the great Tutorial Elise!

Now just to wait for them to release an easy method for using TypeKey on non-MT sites.

I'm having some severe issues getting the typekey component working. I upgraded from 2.661 to the latest version 3.12 and the 'remember me' function as well as the links do not appear.

I tried following your instructions. I don't like having to bring my comments inline though that wasn't too hard to follow (I wasn't really planning on the time for a redesign.)

I got completely lost in Anzi's tutorial - not only too wordy and he leaves out steps, but he assumes that some components are not needed/wanted and adds ones I didn't want. While I appreciate his efforts to explain, it ended up breaking my blog.

I'd like to know a simple step by step upgrade from 2.661 to 3.12. Can anyone point me the only what's necesary to replace while retaining the popups? I'm sure I'm not alone.

Hi Cleo,
As far as I know, Anzi's is the best step-by-step out there. It isn't easy, but his tutorial is thorough and if you follow every step, it works.
To look for anything else written on this I suggest going over to the MT forums and doing a search for "Typekey AND popup" (without the quotation marks). Others have asked about keeping their popups while using Typekey. I don't know if anyone has gotten that combo to work. Good luck!

I've been having this problem for awhile. I can't get the comments link to not show up when comments are closed. I only want comments open on a couple of entries, yet that link at the bottom of each entry always shows up. Any thoughts?

Hi Scazza,

If you set the comments to "closed" on a certain entry, then the "Comments" heading will still show up. If you set the comments to "none" on a certain entry, then that heading should disappear.

If you close comments after you already have a few, you might want to indicate to your readers that the comments are closed. See Closing Comments tutorial for details.

this was VERY helpful. I was going crazy. MT needs to give users a little warning that upgrading is not a simple as it seems. I had no clue that 3.15's templates had new tags. Thanks so much.


Let's say I want to accept comments only from readers with a TypeKey identity (as indeed I do). How then to get rid of the standard but superfluous request for name, e-mail and URL?

If you have a TypeKey identity, there's no reason to enter all that. Moreover, the request itself incorrectly implies that anyone can leave a comment, even if the blogger has his preferences set to receive comments from TypeKey users only.
The non-TypeKey user then becomes frustrated -- and sends angry e-mail -- when his comment submission fails for lack of registration.

Post a comment

(Before posting a comment please see the Comments and Trackbacks Policy. Do you need help troubleshooting your weblog? Please post questions and requests for support at the MT Support Forums. Thanks!)

Remember Me?

(you may use HTML tags for style)

Email to a friend

Email this article to:

Your email address:

Message (optional):