[how to] put a subscribe form on one of my website pages

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

Postby peter_m » 11:23pm, Thu 09 Aug, 2007

sweet, I will get my reading glasses.

Thanks
peter_m
phpList newbie
 
Posts: 4
Joined: 9:03pm, Thu 09 Aug, 2007

Postby peter_m » 1:52am, Fri 10 Aug, 2007

Ok I got it working. The link you supplied was perfect. Thanks.

www dot cmoi-collections dot com/new/alerte.html

Now once my form is filled and submitted I get a default confirmation page that 1) doesn't follow my web site's aesthetics 2) the user has navigated away from my site.

How can I get a confirmation as a simple pop-up window with simple message like "Your e-mail has been saved, thank you" ?

Peter
peter_m
phpList newbie
 
Posts: 4
Joined: 9:03pm, Thu 09 Aug, 2007

Postby H2B2 » 2:37am, Fri 10 Aug, 2007

Glad to know you got it working.

If you need to adapt the confirmation page and other public pages (e.g. preferences/unsubscribe pages) to the
look and feel of your site, you will need to edit the header of your subscribe page through the
admin backend. See http://docs.phplist.com/EditSubscribePageInfo

If you want a popup window instead of the confirmation page, you could take a look at Aaaant's solution in
this same thread:
Aaaant wrote:This is the solution:
Code: Select all
<form method="post" action="http://www.mysite.com/lists/?p=subscribe" name="signup" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">


Ref: http://forums.phplist.com/viewtopic.php?p=25001#25001
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby scarecrow1 » 1:49pm, Mon 20 Aug, 2007

Can someone please help me out with the following code... i have followed the instructions in this forum and in the standard install intructions for setting up your own subsribe page. The code here is called out inside a PHP file. It presents as it should but no action once details are inputed. Please help.
scarecrow1
phpLister
 
Posts: 7
Joined: 5:55am, Tue 27 Mar, 2007

Postby H2B2 » 8:39pm, Sun 30 Sep, 2007

H2B2 wrote:For redirecting to a custom thank you page, you could take a look at these threads:
- http://forums.phplist.com/viewtopic.php?t=8940
- http://forums.phplist.com/viewtopic.php?p=24222
Or search the forum. There might be more...

EDIT - such as this post: http://forums.phplist.com/viewtopic.php?p=31100#31100


You could also take a look at this mod by spamcollect:
spamcollect wrote:How to redirect phpList to custom subscribe and unsubscribe pages. A phpList hack!


In some cases it is necessary to redirect request from your phpList installation to a website in your cms.
PHPList does provide custom pages, but sometimes it is easier to redirect request to your cms, because in a cms for example, you already have your template and all your informations. You don’t have to write the html code again, you just create a new article and your done. So for all that were looking for an easy way, there is none!

You have to edit php code! Let’s start.

First of all, the confirmation page:

Open the file /lists/index.php at line: 531 (remove the dots in the html tags)
Code: Select all
$res = '‘;
$res .= $data[”header”];
$res .= ‘<.h1>‘.$info.’<./h1>‘;
$res .= $html;
$res .= “<.P>“.$GLOBALS[”PoweredBy”].’‘;
$res .= $data[”footer”];
return $res;
Modify it by adding the following:
Code: Select all
$res = '‘;
/*$res .= $data[”header”];
$res .= ‘<.h1>‘.$info.’<./h1>‘;
$res .= $html;
$res .= “<.P>“.$GLOBALS[”PoweredBy”].’<./p>‘;
$res .= $data[”footer”];
*/
$res = header(”Location: http://www.spamcollect.com/confirmation_page”);
return $res;

Next step is the unsubscription page.
Goto line: 589
There you see the following:
Code: Select all
if ($userid) {
$res .= ‘<.h1>…’.$GLOBALS[”strUnsubscribeDone”] .”<./h1><.P>“;
$res .= $GLOBALS[”PoweredBy”].’<./p>‘;
$res .= $pagedata[”footer”];
return $res;
}

Change it to:
Code: Select all
if ($userid)
/*$res .= ‘<.h1>…’.$GLOBALS[”strUnsubscribeDone”] .”<./h1><.P>“;
$res .= $GLOBALS[”PoweredBy”].’<./p>‘;
$res .= $pagedata[”footer”];*/
$res = header(”Location: http://www.spamcollect.com/unsubscribe_confirm”);
return $res;

The last one is the subscribe page. To change that, you’ll have to open the file lists/admin/subscribelib2.php.
Goto line: 288
Code: Select all
if ($subscribepagedata["thankyoupage"]) {
$thankyoupage = $subscribepagedata[”thankyoupage”];
} else {
$thankyoupage = ‘<.h3>‘.$strThanks.’<./h3>‘. $strEmailConfirmation;
}

Modify it so it looks like:
Code: Select all
if ($subscribepagedata["thankyoupage"]) {
//$thankyoupage = $subscribepagedata[”thankyoupage”];
header(’Location: http://www.spamcollect.com/subscription_successful’);
} else {
//$thankyoupage = ‘<.h3>‘.$strThanks.’<./h3>‘. $strEmailConfirmation;
header(’Location: http://www.spamcollect.com/subscription_successful’);
}


Now you’re done and your users won’t see any pages from phplist.
Ref: http://www.spamcollect.com/archives/19 and http://forums.phplist.com/viewtopic.php?p=36093#36093
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby freischwimmen » 11:38pm, Thu 06 Dec, 2007

hi everybody,
i have a small problem concerning attributes;
i incorporated phplist into my existing website and placed a mandatory attribute "name" next to the email adress field; but when a user subscribes only his emailadress shows up in the admin backend lists of users, no name...

when i use the phplist generated subscribe page both name and corresponding email end up in the admin backend list of users...
but even when i copy that code from the phplist generated subscribe page and put it at the place of my website where i want to have it the result when subscribing is as mentioned above, no name, just the email adress...

any hints?
below is the code i place on my website...
thanks very much in advance.


Code: Select all
<!-- newsletter subscribe below here -->

<script language="Javascript" type="text/javascript">
var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>

<form method="post" action="http://www.upmyalley.net/newslist/?p=subscribe" name="subscribeform">
Your Name:<br />
<input type=text name="attribute1"  class="attributeinput" size="30" value=""><br />
<script language="Javascript" type="text/javascript">addFieldToCheck("attribute1","Name");</script>

Your Email:<br />
<input type="text" name="email" value="" size=30> <br />
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
<input type="hidden" name="list[3]" value="signup"><div style="display:none"><input type="text" name="VerificationCodeX" value="" size="20"></div>
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>
freischwimmen
phpList newbie
 
Posts: 1
Joined: 11:58am, Thu 06 Dec, 2007

Postby H2B2 » 7:59pm, Sun 09 Dec, 2007

phpList apparently omits adding double quotes in some input tags. This may be problematic depending on your doc type. E.g. doc type 'strict' might be unforgiving if double quotes are omitted, like in this line for instance:
freischwimmen wrote:
Code: Select all
<input type=text name="attribute1"  class="attributeinput" size="30" value="">


You might try adding the double quotes for type="text" (and check the rest of your subscribe form too), and see if that fixes the issue.
See also: http://docs.phplist.com/CustomSubscribeForm
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby remp » 3:58am, Fri 14 Dec, 2007

how can i make my form so that i can also be to unsubscribe people?
im taken to the subscription page, and then i have to click on unsubscribe but i want to change that so that if they have the ckeckbox "unsubscribe" set, then they unsuscbibe and if they have the subscribe ckeckbox set, then they subscribe? im kind of confused, can anybody help me achieve this?
remp
phpLister
 
Posts: 11
Joined: 8:20am, Wed 12 Dec, 2007

Postby JR » 2:57am, Mon 17 Dec, 2007

I've set up the code as I think I should be and it appears to work fine, but it doesn't subscribe users to the list, instead it subscribes them to an un named list that don't exist. I only have one list and I have this - if there is only one visible list, should it be hidden in the page and automatically subscribe users who sign up (0/1) set to true? Any idea what I'm doing wrong? To check out my code you can go to www.theflowerfarm.biz/contact_us.htm
JR
phpLister
 
Posts: 12
Joined: 3:27am, Thu 31 May, 2007

Postby H2B2 » 11:55am, Mon 17 Dec, 2007

This is your current form code:
Code: Select all
<form method="post" action="http://www.theflowerfarm.biz/lists/?p=subscribe&id=3" name="subscribeform">
<input type="text" name="email" value = "Email Address" size="15"><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
<input type="hidden" name="list[1]" value="signup" />
<center><input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();"></center>
</form>

First you could double check whether the list ID number really is 1. If not, change the hidden signup tag to the correct list ID

Secondly, I suggest you try modifying this line:
Code: Select all
<form method="post" action="http://www.theflowerfarm.biz/lists/?p=subscribe&id=3" name="subscribeform">

to this:
Code: Select all
<form method="post" action="http://www.theflowerfarm.biz/lists/?p=subscribe" name="subscribeform">

See also the documentation on this topic: http://docs.phplist.com/CustomSubscribeForm
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby JR » 6:10pm, Mon 17 Dec, 2007

H2B2 wrote:This is your current form code:
Code: Select all
<form>
<input><br>
<script>addFieldToCheck("email","Email Address");</script>
<input>
<center><input></center>
</form>

First you could double check whether the list ID number really is 1. If not, change the hidden signup tag to the correct list ID

Good catch, that was the problem.
JR
phpLister
 
Posts: 12
Joined: 3:27am, Thu 31 May, 2007

Postby JR » 10:30pm, Mon 17 Dec, 2007

I thought it was working again but now I'm getting this message when I try to test the form.

Sorry, sending the email to request your confirmation failed, please click "Reload" to try again. If it still does not work, it may be because you are listed on our "Black List", which means that you cannot receive emails from our newsletter system. In that case, please contact the administrator.
JR
phpLister
 
Posts: 12
Joined: 3:27am, Thu 31 May, 2007

Postby Ernesto » 7:28pm, Tue 18 Dec, 2007

I dont think that issue is related with your custom subscribe form. Unless you tried to subscribe a user that previously unsubscribed (=blacklisted), I guess the problem is with your mail server settings in config.php. Check if you can send a test message. If not, check your mail server settings and test mode.
Ernesto
PL Freak!
 
Posts: 592
Joined: 2:25am, Thu 08 Jun, 2006

Postby JR » 9:05pm, Tue 18 Dec, 2007

Ernesto wrote:I dont think that issue is related with your custom subscribe form. Unless you tried to subscribe a user that previously unsubscribed (=blacklisted), I guess the problem is with your mail server settings in config.php. Check if you can send a test message. If not, check your mail server settings and test mode.


The users I was trying(one hotmail, two gmail) had never been in the list before and I can send emails out fine. The users that get that message get added into the Database fine, they just never get the confirm message sent out to them.
JR
phpLister
 
Posts: 12
Joined: 3:27am, Thu 31 May, 2007

Postby DRB184 » 9:15am, Mon 24 Dec, 2007

I am not into coding or anything fancy like that - I am just a beginner with a simple ready-to-use CMS site. Having become totally confused with this post, and totally stuffing it up when trying to put on my site, my question is on a slightly different tact, but with the same basic purpose.

I have "wrapped" the subscribe page into my page but have gotten all the format of the PHPList page included with it - so it looks like a page within a page. My question is, rather than playing with code etc to customize it (which I really want to avoid) is it possible to remove the page format from the PHPList page so that it just shows the Subscribe/Unsubscribe entries and the small PHPList logo/link, so that when it is "wrapped" into my page it looks like it was meant to be there.

I hope that is clear enough and that someone can help me with an easy answer. I don't want to customize a page on my site when the PHPList pages have everything I want - I don't want to change the layout or anything like that - just get rid of the format.

Thanks in advance,

David.
DRB184
phpList newbie
 
Posts: 1
Joined: 8:21am, Mon 24 Dec, 2007

PreviousNext

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest