Adding unsubscription function into MovableType has been a very hot topic in MovableType Support Forum (refer to this post and that one.
Tonight, I spent some time to think about it and changed the code a little bit to support unsubscription function.
mt-add-notify.cgi
my $note = MT::Notification->new;
$note->blog_id( $q->param('blog_id') );
$note->email( $q->param('email') );
$note->url( $q->param('url') );
$note->save;
As you can see, I added a line into the code – as shown in red. I am using the existing URL field to add a tag of unsubscription. By utilizing existing fields, we reduce the code changes.
Result for subscription
By default, MovableType does not offer the subscription success confirmation page. It redirect users to the home page of the weblog by default. It is very confusing since subscribers don’t know what happened. We need to create one by yourself and change the _redirect input field of the subscription page. Refer to MovableType’s help for suggestions on adding “subscribe” function to your page.
<form method="post" action="https://home.wangjianshuo.com/mt/mt-add-notify.cgi">
<p>Enter your email address in the textbox below and click Subscribe</p>
<input type="hidden" name="blog_id" value="1">
<input type="hidden" name="_redirect" value="http://www.wangjianshuo.com/news/20020126JSZine/subscribe.htm">
<input name="email" size="56" value="Enter your email"><br>
<input type="submit" value="Subscribe"> </p>
</form>
Unsubscribe
<form method="post" action="https://home.wangjianshuo.com/mt/mt-add-notify.cgi">
<p>Please enter your email address in the box below</p>
<input type="hidden" name="blog_id" value="1">
<input type="hidden" name="_redirect" value="http://www.wangjianshuo.com/news/20020126JSZine/unsubscribe.htm">
<input name="email" size="56" value="Enter your email"><br>
<input type="hidden" name="url"
value="unsubscribe" / >
<input type="submit" value="Unsubscribe"> </p>
</form>
I added a hidden field called URL with value of unsubscribe. Thus you can see the who is willing to unsubscribe from the notification list and do it manually when you notice it.
Want to have a try?
Please check the homepage of my weblog. The notification subscription area is at the right-top corner. You can also directly visit the subscription page.
Next step
It is ideal if we can add code for removing the Email from $note database directly in MT-add-notify.cgi. I don’t have time to do it now, but it should be very easy. Please let me know if you have done so.
I just like it and willing to receive more information from you. Please send email to samantha@bytefocus.com
I am not positive the place you’re getting your information, however great topic. I must spend some time finding out more or understanding more. Thanks for fantastic info I used to be looking for this info for my mission.