tips and tricks for movable type

email not required for comments
October 04, 2003

Here's some code I'd noted from a forum post by Ben Trott quite a while back - it allows comments to be posted without an email address required. I've slightly updated the change for the latest version of the code.

Open up lib/MT/App/Comments.pm (save a backup first!) and look for this code (currently at lines 70-73 in v2.64):

if (!$blog->allow_anon_comments &&
(!$q->param('author') || !$q->param('email'))) {
return $app->handle_error($app->translate(
"Name and email address are required."));

and replace with:

if (!$blog->allow_anon_comments && !$q->param('author')) {
return $app->handle_error($app->translate(
"Name is required."));

Save and upload the new version of the file to your server in ASCII mode.

Note that I've not actually tested the code myself - I just wanted to document it for reference by others who might be interested in doing this.

Comments

Hi Girlie, yesterday I was searching for MT tag, how to have different Category in one page & how I can link one topic to many category? by chance I found your weblog It's so good & useful, and from that time till now I'm reading your weblog.If possible I want use your notes in my weblog (in Farsi).
And please if possbile help me for that two question?

by Taha Ebrahimi | 10.06.03 03:05 PM

MMMmmm I've allowed my visitors to post comments without leaving their e-mail addresses by chequing the "allow anonymous comments" options on the Configuration's Preferences of my blog. It's much simplier than having to "hack" my MT files...

by El Fer | 10.10.03 06:54 PM

When you check "Allow Anonymous Comments", neither a name nor email address is required. Some users want commenters to at least include a name, but don't want to require an email address. That's what this hack is all about.

I wouldn't have wasted my time posting something that could be done just by clicking a checkbox within MT. ;-)

by girlie | 10.10.03 07:40 PM

I hate exposing my email to all those spambots...

by me | 10.15.03 01:11 AM

Forgive me for this tell-tale n00b question, but I was able to find and edit the code for Comments.pm in WordDoc, but how do I save it so that it is the original file type? I changed the file extension back to .pm, but the file type seems to have changed.

by tontamoo | 10.19.03 08:01 AM

NM, I got it. I opened up the file in the Microsoft Visual Studio 6.0 IDE. Thanks for this hack!

by tontamoo | 10.19.03 08:25 AM

Hey Girlie,

It's not working on my site. I did everything and it's still asking me

"Name and email address are required."

I even tried commenting with on this post with just my name and comment, but it's asking for name and email required?

by Christian | 10.31.03 10:32 PM

1) Are you sure the new copy of Comments.pm overwrote the old one on your server?

2) If you mean you commented here without an email address, well, I require one. ;-)

by girlie | 11.01.03 08:48 AM

I think I have the same problem as Christian. I changed comments.pm & I'm sure the new copy overwrote the old one, but still no difference. Weird. Any ideas? :)

by Lotta | 11.23.03 08:12 AM

Thanks for all the great info! I just did this (using emacs directly on the server, so no chance of uploading in binary by accident). It worked, so those of you for whom it didn't work...I'd suggest:

  • Make sure to rebuild your site!
  • Make sure downloaded AND uploaded the Comments.pm file in ASCII mode. (Not auto or binary).
  • Double make sure you replaced the original file and it has the exact same name as before...e.g. you're not getting some weird extra extention (like Comments.pm.txt)
  • I would highly recommend never using Word for anything related to web design. It will add formatting weirdness behind the scenes that you cannot see. Use notepad. Or, download one of many great freeware enhanced text editors. They are like notepad but with color coding and other features to help you out.
by mahalie | 01.23.04 05:14 PM

Users of MT-Blacklist should also(?) change MTBlPost.pm (i'm not sure if you have to change Comments.pm if you are using Blacklist)
It worked fine untill I installed MT-Blacklist, it works fine after changing MTBlPost.pm, so Christian and Lotta: try it! :-)

by Ronald | 03.07.04 06:01 AM

I installed Blacklist 1.63 on MT 2.64 two days ago and it was sweet. After I ran De-Spam tonight all my comments are duplicated...not two comments but the text is duplicated!!

Any help would be appreciated.

by feste | 05.17.04 11:08 PM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 1
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/157)

» This is addictive.
Excerpt: coverting to MySQL 官方版的說明文件少寫了兩個重點: mt.cfg 要保留原先 Berkeley DB 的兩行 DataSource,...
Weblog: pagras.net
Tracked: 03.30.04 08:04 AM