tips and tricks for movable type

notifications: single form for subscribe and unsubscribe
August 21, 2004

One new feature in Movable Type 3.0 which hasn't received much attention is the unsubscribe function for notifications. Visitors who've added themselves to your notification list can now unsubscribe themselves, if you provide a form for them to do so.

Rather than have two forms, one for subscribing and one for unsubscribing, you can combine these functions into a single form.

<h2>Notify List</h2>
<div class="link-note">
<form method="post" action="<$MTCGIPath$>mt-add-notify.cgi">
<input type="hidden" name="blog_id" value="<$MTBlogID$>" />
<input type="hidden" name="_redirect" value="<$MTBlogURL$>" />
<input name="email" size="20" /><br />
<input type="radio" name="__mode" value="subscribe" />&nbsp;
<label for="subscribe">subscribe</label><br />
<input type="radio" name="__mode" value="unsubscribe" />&nbsp;
<label for="unsubscribe">unsubscribe</label><br />
<input type="submit" value="update" />
</form>
</div>

Currently, new subscriptions must be confirmed via email; however, this is not required for a visitor to unsubscribe.

Comments

Hello, I tried your code, I use MT 3.01D, and I got this error:

An error occurred:
Email notifications have not been configured! The weblog owner needs to set the EmailVerificationSecret configuration variable. at lib/MT/App/NotifyList.pm line 31.

Any idea about this? Thank you.

by Thomas [TypeKey Profile Page] | 08.24.04 04:16 PM

You need to add the following line to your mt.cfg configuration file:


EmailVerificationSecret PASSWORD

where PASSWORD is a string of your choice.



In my case, I also had to uncomment the EmailAddressMain variable.

Now if only the templates for e-mail and confirmation of subscription / unsubscription were easily confirgurable...

by straz [TypeKey Profile Page] | 08.29.04 01:20 PM

Thank you straz, it works!

by Thomas [TypeKey Profile Page] | 08.29.04 03:45 PM

This code says that the e-mail address was not subscribed, when it is in fact there. Any ideas?

by Mediapulse [TypeKey Profile Page] | 09.17.04 03:54 PM

You can also use ADD the "checked=checked" on the subscribe input box so that it is preselected as an option to subscribe. Also, good idea to use a basic validation script on this form. A good one can be found at javascript.internet.com.

by travel sniper [TypeKey Profile Page] | 09.24.04 06:19 AM

I also tried this code, and did as you suggested for Thomas, but I get the following error:
An error occurred:

Email notifications have not been configured! The weblog owner needs to set the EmailVerificationSecret configuration variable. at lib/MT/App/NotifyList.pm line 31.

Any suggestions on this? I looked at this file, but I see no place to set the variable, nor have I the knowledge to know what the variable should be.

Could you help?

by Susan [TypeKey Profile Page] | 11.28.04 09:22 AM

I keep getting an error at http://validator.w3.org
about the command

[code]
Below are the results of attempting to parse this document with an SGML parser.

Line 615, column 12: reference to non-existent ID "subscribe"

subscribe

This error can be triggered by:

A non-existent input, select or textarea element
A missing id attribute
A typographical error in the id attribute
Try to check the spelling and case of the id you are referring to.

Line 617, column 12: reference to non-existent ID "unsubscribe"

unsubscribe

This error can be triggered by:

A non-existent input, select or textarea element
A missing id attribute
A typographical error in the id attribute
Try to check the spelling and case of the id you are referring to.
[/code]

by bubazoo [TypeKey Profile Page] | 01.22.05 09:03 PM

This code doesn't validate. Any idea why?

by Umm Junayd [TypeKey Profile Page] | 01.25.05 07:59 AM

Excellent! I wondered why no one had signed up for my email list for a while. They must have been getting errors. This fixed it. Thank you!

by Kim Novak [TypeKey Profile Page] | 02.17.05 09:08 PM

This may sound like a stupid question, but where do I put that code? Right now I have a form on my main index page where you just fill in you email address. It looks like this:

I'm not a programmer but I can usually follow along with a little help. Thanks.

by Bunglegirl [TypeKey Profile Page] | 04.25.05 12:21 PM

Okay, I figured it out, duh. Sorry to waste your time!

by Bunglegirl [TypeKey Profile Page] | 04.25.05 12:59 PM

Hello all. I have it working, except it just automatically adds them to the notify list and sends them the following, with a link that is just all wrong. Anyone know what I am doing wrong?

Email

Thanks for subscribing to notifications about updates to
Merely Adequate. Follow the link below to confirm your subscription:

/cgi-bin//mt-add-notify.cgi?__mode=confirm;
email=mwelsh%40neo.rr.com;
magic=4bymLBrn.gaBQ;
blog_id=1;
redirect=http%3A%2F%2Fmerelyadequate.net

If the link is not clickable, just copy and paste it into your browser.

--
Powered by Movable Type
Version 3.17
http://www.movabletype.org/

/Email

by Monolith aka Mikey [TypeKey Profile Page] | 07.04.05 05:45 PM

To bubazoo and Umm Junyard:

I got my page to validate by adding these dummy ID tags.

Not ideal, I know, but I couldn't find any other way to do it.

Now, if I could get the email to show a proper link. Has anyone else had the problem that I describe in my previous post?

by Monolith aka Mikey [TypeKey Profile Page] | 07.04.05 10:13 PM

I found my problem! :-)

I did not have an absolute path set for the following in MT.cfg.

CGIPath http://www.example.com/movabletype/

I had it set as a relative path, which works just fine for everything except allowing others to confirm their subscription.

by Monolith aka Mikey [TypeKey Profile Page] | 07.05.05 03:09 AM

Ok it continues to give me a The address "email addy here" was not subscribed.

Not sure what to do there.

by News Beak [TypeKey Profile Page] | 08.31.05 04:14 PM

When I use this code with 3.1.6 it adds the address to the notification list, but when I try to remove an address using the "unsubscribe" button I'm told that "The address name@dom.com was not subscribed." even thought it *is* on the list. Any ideas?

by Chas Waggins | 10.05.05 10:34 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: 3
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/201)

» subscribe form enhancements
Excerpt: [the girlie matters] tips and tricks: notifications: single form for subscribe and unsubscribe -- One new feature in Movable Type...
Weblog: kdlb-links
Tracked: 08.22.04 12:18 AM

» Notification unsubscribe
Excerpt: girlie matters
Weblog: Gwen Harlow resources
Tracked: 08.30.04 05:20 PM

» Subscribe & Unsubscribe
Excerpt: All those little things I might have picked up if I'd read the MovableType documentation more thoroughly. The "subscribe" now works properly thanks to some deft config editing and the new "unsubscribe" options should also work (thanks to the tips...
Weblog: frumbert.org: textblog
Tracked: 11.28.04 10:06 PM