5 Aug 2003
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.
Hello guys.
My remember me is not working. Ive done all you say here but nothing happened. Can anyone help me?
Thanks.
0k.. h0w d0 this w0rk?? i’m c0nfused??
Yeah Ive got same problem..think I need to use a different software, this is giveing me a headache
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. - defaulttemplates/sitejavascript.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.
Adam Kalsey
Mobile: 916.600.2497
Email: adam AT kalsey.com
AIM or Skype: akalsey
©1999-2008 Adam Kalsey.
Content management by Movable Type.
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/