Gossamer Forum
Home : Gossamer Threads Inc. : Discussion :

Add a link & also include newsletter subscription

Quote Reply
Add a link & also include newsletter subscription
Hi,

Does anybody know how I would get Links2 to:

Include a checkbox on the add link template that would also allow the user to subscribe to the email updates at the same time (on by default) ;-))

Thanx in advnace,

Regards,

Dale.

Quote Reply
Re: Add a link & also include newsletter subscription In reply to
I think if you wanted to do that you would basically have to cut and paste the code from subscribe.cgi into add.cgi and then tidy it up a bit and then add the new field to all the add_*.html templates and modify_*.html templates.

Someone else may think of an easier way.

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Thanks for the reply, I did think of that, but I'm not that confident in doing it properly! ;-)

(I need a step-by-step guide, like some of the tasks in the Modifications section
of the gossamer-threads forum.)

Thanks anyway, maybe some kind soul can tell me exactly what I need to do to
get this done. ;-))

I would imagine that a lot of people would find this useful too.

Regards,

Dale.

Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Just got to get something to eat.....if you haven't got an answer when I get back I will try to help you out :)

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Try to add the following codes in your add_success.html template:
Code:
<form action="<%db_cgi_url%>/subscribe.cgi" method="POST">
<div class="margin">
<%if message%>
<p><strong class="error"><%message%></strong></p>
<%endif%>
<p><select name="action">
<option value="subscribe">Subscribe
<option value="unsubscribe">Unsubscribe</select>
to the list

Name: <input name="name" value="<%Contact Name%>">
Email: <input name="email" <input name="email" value="<%Contact Email%>">
<input type="submit" value="Subscribe">
</p>
</div>
</form>
If that's not good enough, check out the following thread:
http://www.gossamer-threads.com/...ew=&sb=&vc=1

Btw, this question should be better posted in the Links Customization Forum.

Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Or, you could cut and paste the subs from subscribe.cgi into add.cgi and rename sub main to sub main_newsletter and then add &main_newsletter; before the add_success page is shown and then change

sub main_newsletter {
# --------------------------------------------------------
$|++; # Flush Output.
my %in = &parse_form;
my $action = $in{'action'};

CASE: {
($action eq "subscribe") and do { &subscribe (%in); last CASE; };
($action eq "unsubscribe") and do { &unsubscribe (%in); last CASE; };
&site_html_mailing();
};
}


......to.........

sub main_newsletter {
# --------------------------------------------------------
$|++; # Flush Output.
my %in = &parse_form;
my $action = $in{'newsletter'};

CASE: {
($action eq "subscribe") and do { &subscribe (%in); last CASE; };
&site_html_mailing();
};
}


.......and add the new newsletter field in add.html and then change.......

sub subscribe {
# -----------------------------------------------------------
# Adds a user into a mailing list.
#
my %in = @_;
my $list = $db_email_name;

# Make sure the email address at least looks like an email address.
my $email = $in{'email'};
my $name = $in{'name'};

..........to

sub subscribe {
# -----------------------------------------------------------
# Adds a user into a mailing list.
#
my %in = @_;
my $list = $db_email_name;

# Make sure the email address at least looks like an email address.
my $email = $in{'Contact Email'};
my $name = $in{'Contact Name'};

..so it uses the same fields as add.html


Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Ok, that's great thanks.
Will the functionality of the standard newsletter subscribe page still remain as it was?
Thanks again,
Dale.

Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Yes because subscribe.cgi hasn't been modified.

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: Add a link & also include newsletter subscription In reply to
Excellent, thanks for all your help.
Perhaps a silly question, but have you implemented the changes you suggested and do they work before a non-programmer like me hacks away?
(and yes, I will of course backup the files just in case ;-) )
Thanks again,
Dale.

Quote Reply
Re: Add a link & also include newsletter subscription In reply to
HI,

I did start to create the mod on my own version of Link2 but I got side tracked and didn't finish it.

If you have any trouble I'd be happy to help.

Paul Wilson.
Installations:
http://www.wiredon.net/gt/