Gossamer Forum
Home : Products : Gossamer Links : Discussions :

User email subscribtion management

Quote Reply
User email subscribtion management
Hi,

I have been trying to add a couple of check boxes to the signup-form template in order to let the user subscribe to the newsletter and to give us permission to send him emails relative to his links. I have not been very successful. I could not manage to have the data recorded in the database.

It would also be great if the user could have access to a control panel where he could edit his information (password, name, email preferences). Any suggestions about implementing this?

Thanks for your help.

Jean--

Quote Reply
Re: User email subscribtion management In reply to
In Reply To:
I have been trying to add a couple of check boxes to the signup-form template in order to let the user subscribe to the newsletter and to give us permission to send him emails relative to his links.
Hi,

you have to add a form field in the add.html template like this:
In Reply To:
Subscribe to Newsletter?
<input type="radio" name="Newsletter" value="Yes" checked> Yes
<input type="radio" name="Newsletter" value="No"> No
and in add.cgi around line 110 in sub add_link:
In Reply To:
# Validate the form input..
my $db = $DB->table ('Links');
my $cdb = $DB->table ('Category');
my $cat_links = $DB->table ('CatLinks');
my $name = $input->{'Contact_Name'} || $input->{'Contact Name'} || ($USER ? $USER->{Name} : '');
my $email = $input->{'Contact_Email'} || $input->{'Contact Email'} || ($USER ? $USER->{Email} : '');
my $newsletter = $input->{'Newsletter'}; # add this line
and some lines below change the line:

my $res = $user_db->insert ( { Username => $email, Name => $name, Email => $email, Status => 'Not Validated', Password => $pass });

to the following:

my $res = $user_db->insert ( { Username => $email, Name => $name, Email => $email, Newsletter => $newsletter, Status => 'Not Validated', Password => $pass });

The addition to the original line is marked red here.

After you made the changes the Newsletter field in the Users table should be set accordingly to the user's choice and aditionally the tag <%Newsletter%> should be available in the for the add_success.html template so you could use
In Reply To:
<%if Newsletter eq 'Yes'%>
You have been subscribed to the Newsletter.
<%endif%>
Hope this helps.
(Just did that yesterday on my own site and it seems to work as intended)

Andreas

--------------------------------------------
http://www.archaeologie-online.de
Quote Reply
Re: User email subscribtion management In reply to
How can i add this feature to the new user singup/registeration page?