Remember Me, Movable Type

Freshness Warning
This article is over 15 years old. It's possible that the information you read below isn't current.

It’s been pointed out a few times that my comment forms don’t always remember you when you check the box. That’s fixed, and here’s a few tips on making your MT comments work better.

First, the problem that my comments form had was that the MT comment JavaScript sets the cookie path to a blank string. This causes the browser to only set the cookies in the current directory. So if your entries are in multiple directories like mine, the cookies don’t work.

The other cookie-related problem that many sites have is that their site is available at www.site.com and site.com. As far as the computer is concerned, those two addresses might be different servers and a cookie is only available on the hostname that it was set for. When someone enters a comment at www.site.com the cookie is set for the hostname www.site.com. If the user then later visits site.com, the cookie isn’t available, so the form contents aren’t remembered.

A simple adjustment to your MT cookie code will fix both these problems. Just change the rememberMe and forgetMe JavaScript so that they set cookies with the proper host and the root path. Here’s a copy of each function, already modified. Just change the ‘site.com’ to your server’s name.

function rememberMe (f) {    var now = new Date();    fixDate(now);    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);    setCookie('mtcmtauth', f.author.value, now, '/', 'site.com', '');    setCookie('mtcmtmail', f.email.value, now, '/', 'site.com', '');    setCookie('mtcmthome', f.url.value, now, '/', 'site.com', '');}function forgetMe (f) {    deleteCookie('mtcmtmail', '/', 'site.com');    deleteCookie('mtcmthome', '/', 'site.com');    deleteCookie('mtcmtauth', '/', 'site.com');    f.email.value = '';    f.author.value = '';    f.url.value = '';}

The other usability problem that most MT comment forms have is even when the form contents are remembered, the Remember Me checkbox or radio button is not. Users often don’t know if they need to check the box again in order for their information to continue to be remembered. So to be on the safe side, they check the box every time they enter a comment.

If the user’s information is remembered and you have a checkbox labeled “Remember Me,” the state of the checkbox should be remembered as well. This is very simple to do as well. Find the JavaScript code that writes the user’s remembered information into the form and add a few lines that sets the state of the checkbox. Right after the line that says:

document.comments_form.url.value = getCookie("mtcmthome");

Add the following…

if (getCookie("mtcmtauth")) {   document.comments_form.bakecookie.checked = true;}

By making it easier for people to comment on your blog, more people will. And more people commenting means more traffic for your site.

Jesper
August 7, 2003 3:14 PM

Phillip: Use .me.com as a host and it'd match anything.me.com or just me.com.

Trackback from Brainstorms and Raves
August 7, 2003 10:32 PM

Movable Type Tweak for Comments Cookie

Excerpt: Adam Kalsey has posted a helpful tweak for Movable Type's Comments cookie to more consistently apply its ability to remember the user (if the user has selected the checkbox to be remembered, of course). Check out Adam's August 5th post, Remember Me, Mo...

Trackback from Quick Links
August 8, 2003 12:06 AM

Some fixes to make to the MT Comment system

Excerpt: http://kalsey.com/2003/08/remember_me_movable_type/...

Trackback from magpiebrain
August 8, 2003 5:02 AM

Remember Me improvements for MovableType

Excerpt: Thanks to Brainstorms & Raves for this - Adam over at Measure Twice has come up with some fixes/improvements for MovableType’s ‘remember me’ functionality on the comments page. Would of spotted this myself but forgot to add Measur...

Trackback from Tribblescape
August 12, 2003 10:47 AM

Fixing comment cookies in Movable Type

Excerpt: Adam Kalsey has an excellent article on fixing Movable Type's "remember me" mechanism. The JavaScript produced by Movable Type doesn't handle "remember me" cookies across different portions of a domain (www.site.com versus site.com)...

Trackback from liens
August 19, 2003 5:52 PM

A fix for cookies in comments form

Excerpt: Remember Me, Movable Type :: Kalsey Consulting Group...

aroon
December 9, 2003 10:36 PM

WOW. thank you so much, ive been trying to figure this out forEVER. just wondering about that last part though. [your comments seem to be different] on my comment template [stock] i already have these lines: if (getCookie("mtcmtauth")) { document.comments_form.bakecookie[0].checked = true; } else { document.comments_form.bakecookie[1].checked = true; } which is sufficient for making sure that radio button is already selected as to not confuse people. thanks so much for the info!

aroon
December 9, 2003 10:45 PM

unfortunately it didnt fix my problem =\ my comments refuse to even try to set cookies. i figured this out by using firebird and having it ask me anytime a website tried to set cookies. all my friends mt blogs set cookies fine. mine didnt even try. i guess ill search even more for a fix. again, thnx for the info though, im sure it will help a bunch of poeple

Trackback from Snowblink
December 10, 2003 8:13 AM

Comments updated

Excerpt: After prompting from Alicia, I investigated the comments issue. MT sets the path on the cookie to the current directory. What this means is that if you are using permanent links, then the cookie will only remember you on an...

Slice Guy
September 10, 2004 12:38 AM

What is the difference in "movable type" and "blogging", I am wanting to add this functionality to my website? Thanks for helping out a webmaster newbie.

Adam Kalsey
September 10, 2004 12:45 AM

Movable Type is a software product that is used to create blogs. If you were to apply your question to cars, you'd end up with "what's the difference between Ford and Driving." Blogging is something you do and Movable Type is a product you can use to do it. Movable Type is aimed at people who are comfortable with installing and managing products on their Web servers. For everyone else, they have a product called TypePad. You can find out more about Movable Type and TypePad at http://movabletype.com/ and http://typepad.com/

Jorge Lesmes
March 4, 2005 4:38 PM

Hello guys. My remember me is not working. Ive done all you say here but nothing happened. Can anyone help me? Thanks.

NataLie
April 19, 2006 1:20 PM

0k.. h0w d0 this w0rk?? i'm c0nfused??

wholesale
June 17, 2006 12:21 AM

Yeah Ive got same problem..think I need to use a different software, this is giveing me a headache

kwmccabe
August 9, 2006 6:59 AM

Interesting that you don't have the "Remember personal info?" checkbox on your own comment form. It should be noted where these changes are to be made. - default_templates/site_javascript.tmpl, for instance, for new blogs - mt.cgi : Edit Template: Site JavaScript (i.e., in the database) for existing blogs

These are the last 15 comments. Read all 20 comments here.

This discussion has been closed.

Follow me on Twitter

Best Of

  • How not to apply for a job Applying for a job isn't that hard, but it does take some minimal effort and common sense.
  • Movie marketing on a budget Mark Cuban's looking for more cost effective ways to market movies.
  • California State Fair The California State Fair lets you buy tickets in advance from their Web site. That's good. But the site is a horror house of usability problems.
  • Customer reference questions. Sample questions to ask customer references when choosing a software vendor.
  • Comment Spam Manifesto Spammers are hereby put on notice. Your comments are not welcome. If the purpose behind your comment is to advertise yourself, your Web site, or a product that you are affiliated with, that comment is spam and will not be tolerated. We will hit you where it hurts by attacking your source of income.
  • More of the best »

Recently Read

Get More

Subscribe | Archives

Recently

Assumptions and project planning (Feb 18)
When your assumptions change, it's reasonable that your project plans and needs change as well. But too many managers are afraid to go back and re-work a plan that they've already agreed to.
Feature voting is harmful to your product (Feb 7)
There's a lot of problems with using feature voting to drive your product.
Encouraging 1:1s from other managers in your organization (Jan 4)
If you’re managing other managers, encourage them to hold their own 1:1s. It’s such an important tool for managing and leading that everyone needs to be holding them.
One on One Meetings - a collection of posts about 1:1s (Jan 2)
A collection of all my writing on 1:1s
Are 1:1s confidential? (Jan 2)
Is the discussion that occurs in a 1:1 confidential, even if no agreed in the meeting to keep it so?
Skip-level 1:1s are your hidden superpower (Jan 1)
Holding 1:1s with peers and with people far below you on the reporting chain will open your eyes up to what’s really going on in your business.
Do you need a 1:1 if you’re regularly communicating with your team? (Dec 28)
You’re simply not having deep meaningful conversation about the process of work in hallway conversations or in your chat apps.
What agenda items should a manager bring to a 1:1? (Dec 23)
At least 80% of a 1:1 agenda should be driven by your report, but if you also to use this time to work on things with them, then you’ll have better meetings.

Subscribe to this site's feed.

Contact

Adam Kalsey

Mobile: 916.600.2497

Email: adam AT kalsey.com

Twitter, etc: akalsey

Resume

PGP Key

©1999-2019 Adam Kalsey.