Gossamer Forum
Home : Products : Links 2.0 : Customization :

"Add to mailing list" checkbox on Site Submit

Quote Reply
"Add to mailing list" checkbox on Site Submit
How do I go about adding a checkbox on the site submit page which allows the user to be automatically added to the mailing list too?

I've tried searching the forum, but have not found anything relevant yet...

M.
Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
The quick and dirty solution is to add the email subscribe form in the add_success.html template file.

Replace the following input fields:

Code:
<input name="email" size=15>
<input name="name" size=15>

with the following:

Code:
<input name="name" value="<%Contact Name%>" size=75>
<input name="email" value="<%Contact Email%>" size=75>

Well, what you would have to do is the following...(to allow users to add their email to the email.db file from the add.cgi script)...(And before doing this...make sure that you keep a backup of your add.cgi, email.db, and links.db files)...

1) COPY the following codes:

Code:
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();
};

and PASTE them into your sub main routine in your add.cgi script.

2) Then copy the rest of the subscribe.cgi script into your add.cgi script. In the new subs that you put in the add.cgi, replace all occurences of the following:

Code:
my $email = $in{'email'};

with the following:

Code:
my $email = $in{'Contact Email'};

AND

Code:
my $name = $in{'name'};

with the following:

Code:
my $name = $in{'Contact Name'};

3) Then in your add_html template file, add the following codes:

Code:
Subscribe/Unsubscribe from our Site Newsletter:

<select name="action">
<option value="subscribe"> Subscribe</option>
<option value="unsubscribe"> Unsubscribe</option>
</select>

4) Then in the sub site_html_add_failure routine, add the following codes:

Code:
if ($in{'action'} eq 'subscribe') {
$subscribe .= qq|
<select name="action">
<option value="subscribe" SELECTED> Subscribe</option>
<option value="unsubscribe"> Unsubscribe</option>
</select>
|;
}
if ($in{'action'} eq 'unsubscribe') {
$subscribe .= qq|
<select name="action">
<option value="subscribe"> Subscribe</option>
<option value="unsubscribe" SELECTED> Unsubscribe</option>
</select>
|;
}

at the top of this sub.

Then define the following tag in this sub.

Code:
subscribe => $subscribe

5) Add the following codes in your add_failure.html routine:

Code:
Subscribe/Unsubscribe from our Site Newsletter:

<%subscribe%>

6) Then in your sub site_html_add_failure file add the following codes:

Code:
if ($in{'action'} eq 'Yes') {
$subscribe .= qq|Yes|;
}
elsif ($in{'action'} eq 'No') {
$subscribe .= qq|No|;
}
else {
$subscribe .= qq|You are not subscribed to our Newsletter|;
}

Define the following tag:

Code:
subscribe => $subscribe

7) Then in your add_success.html, add the following codes:

Code:
Subscribe: <%subscribe%>

That should do it...there may be some bugs, but we can squash them...

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Hi Eliot, thanks for your help...

I've worked through your mod and have spotted some possible errors (I think!) and tweaked those but it's not quite working yet.

Anyway, firstly the changes...

(6)

Code:
if ($in{'action'} eq 'Yes') {
$subscribe .= qq|Yes|;
}
elsif ($in{'action'} eq 'No') {
$subscribe .= qq|No|;
}
else {
$subscribe .= qq|You are not subscribed to our Newsletter|;
}

Should read...

Code:
if ($in{'action'} eq 'subscribe') {
$subscribe .= qq|Yes|;
}
elsif ($in{'action'} eq 'unsubscribe') {
$subscribe .= qq|No|;
}
else {
$subscribe .= qq|You are not subscribed to our Newsletter|;
}


I also removed the following lines from the subscribe and unsubscribe routines to stop it going off to the respective pages...

Code:
# Go to the success page.
&site_html_mailing ('unsubscribe');

# Go to the success page.
&site_html_mailing ('subscribe');

And this to stop already in the database errors...

Code:
and &site_html_mailing_error ("You are already a subscriber!")


So now it all adds/removes to the email.db file fine, but isn't adding the link to links.db file. Any ideas...

M. Wink
Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Thanks for pointing out those errors...However...you need to coordinate the values of the "ReceiveMail" --> Yes and No into the LINKS database and in the email.db file...so, actually it is not a synatax error.

I will have to look at the codes again when I have time and see what I am missing.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
I am just wondering if any solution has been found for that coordination problem...

------------------
Thomas
japanreference.com

Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
I've not had a chance yet to take it any further myself Frown

m.
Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Would be a great mod indeed! I am crossing my fingers... Smile

------------------
Thomas
japanreference.com

Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
If this Mod does not work for you...The quick and dirty solution is to add the subscribe form in your add_success.html form and then use the following values in your name and email fields:

<%Contact Name%>
<%Contact Email%>

Not an ideal solution...but I use this in my site and I have found that subscriptions from the add success page have increased about 30% in the past few months.

Best of luck!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Much obliged for your advice, Eliot! Perhaps not ideal, but hopefully effective...

------------------
Thomas
japanreference.com

Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Not ideal...but very effective. As I mentioned I noticed a 30% increase in email subscriptions of Link Owners coming from the add success screen.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
It worked great for me, much quicker and easier to implement, if a tad clunky Smile

m.

------------------
world wide web stimulus www.linkdup.com creative design online

Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
 
Quote:
clunky

Hmmm....well, if you want the ideal solution...learn some Perl and try to figure out a solution on your own.

This type of Mod is NOT a high priority for me, so I am not motivated to clean up the codes to make it work.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
That wasn't intended as sarcastic remark actually Smile I'm genuinely happy with the results...

m.
Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Well, it sure came off that way.

Best of luck with your LINKS project.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
Anthro TECH, L.L.C
anthrotech.com
* Check Resource Center
* Search Forums
* Thinking out of the box (codes) is not only fun, but effective.


Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
I followed your advice, Eliot, but obviously I am unable to get it to run smoothly. I added the <%Contact Name%> and <%Contact Email%> fields in my add_success template, but instead of submitting the subscription info people are being transferred to the email template and forced to enter their subscription data once again.

Here's my add_success.html:

==> http://www.japanreference.com/...iles/add_success.txt

Guess I must have misunderstood something... Wink

Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
You are missing the subscribe/unsubscribe buttons! (Which means that you did not follow the previous discussion very carefully since you did not copy the complete Email form from the email template files.)

Wink

You could simply add a hidden field, like the following:

Code:

<input type="hidden" name="action" value="subscribe">


Regards,

Eliot Lee
Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
Well, I assume I wasn't reading it very carefully... Blush

Thanks for your swift assistance.

Quote Reply
Re: "Add to mailing list" checkbox on Site Submit In reply to
You're welcome.

Regards,

Eliot Lee