[mod] Redirect to custom 'Thank you' page

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.

[mod] Redirect to custom 'Thank you' page

Postby phader » 10:38pm, Fri 23 Mar, 2007

I've created a custom subscribe page and I'd like to take the user to a certain URL after they registered, instead of the default thank you page. How do I do that?

Thanks,
phader
phader
phpList newbie
 
Posts: 3
Joined: 10:34pm, Fri 23 Mar, 2007

Postby SaWey » 11:31pm, Fri 23 Mar, 2007

You can change this in the phplist code if you want to redirect your users.

in subscribelib2.php at line 288 you will find
Code: Select all
# personalise the thank you page
  if ($subscribepagedata["thankyoupage"]) {
    $thankyoupage = $subscribepagedata["thankyoupage"];
  } else {
    $thankyoupage = '<h3>'.$strThanks.'</h3>'. $strEmailConfirmation;
  }


You can try modifying something in there...
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

Postby phader » 12:52am, Tue 27 Mar, 2007

Thanks. I added a header() call at the appropriate place and it seems to work. Now I'm trying to do the same with the "You've been unsubscribed" page. I can't seem to find the file to edit in order to change that page as well.
Any hints?

Thanks,
phader
phader
phpList newbie
 
Posts: 3
Joined: 10:34pm, Fri 23 Mar, 2007

Postby SaWey » 1:42am, Tue 27 Mar, 2007

You can find that in the function
Code: Select all
unsubscribePage($id) {

in 'index.php' at line 541
SaWey
PL Master
 
Posts: 192
Joined: 8:28pm, Wed 08 Mar, 2006
Location: Belgium

Custom thank you pages

Postby emailwedgy » 6:54am, Sun 08 Apr, 2007

I have a similar setup, but would like to leave room for expansion. My subscribe form sits off the side of my shop pages (Each shop in a different directory on the server). But regardless of which shop I am in, it goes to my one and only thank you page, set up during install.

Is there a way to 'case' one of the fields of the referring page to decide which shop's thank you page to jump to?

All help appreciated.

Phil
emailwedgy
phpList newbie
 
Posts: 2
Joined: 2:10am, Sun 01 Apr, 2007

Postby hellomobe » 4:36pm, Sun 15 Apr, 2007

phader wrote:Thanks. I added a header() call at the appropriate place and it seems to work. Now I'm trying to do the same with the "You've been unsubscribed" page. I can't seem to find the file to edit in order to change that page as well.
Any hints?

Thanks,
phader


Please share how you modified the code. I would like to do the same. Sorry, steep learning curve on the php -- don't know how to use the header () call. Thanks
hellomobe
phpList newbie
 
Posts: 3
Joined: 10:39pm, Sat 31 Mar, 2007

Postby piersg » 1:19pm, Thu 19 Apr, 2007

I got it to work a different way, not too elegant but it does the trick...
    Open your phplist database in PHPMyAdmin or similar.
    Open and browse the phplist_subscribepage_data table
    edit the "thankyoupage" entry to something like this


Code: Select all
<h3>Thank you for subscribing to our newsletters.</h3>
Your email has been added to our system. You will be e-mailed shortly with a request to confirm your membership. Please make sure that you click the link in that message to confirm your subscription.

<script language="javascript">
  <!--
  window.location="/newsletters/thanks";
  -->
</script>
Click <a href=/members>here</a> to return to the members' area
piersg
phpList newbie
 
Posts: 1
Joined: 1:04pm, Thu 19 Apr, 2007

Postby H2B2 » 2:44am, Fri 20 Apr, 2007

hellomobe wrote:don't know how to use the header () call.
Something like
Code: Select all
header("Location:http://yourdomain.com/yourpage.php");

Ref: http://nl3.php.net/header
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby gspark » 1:05am, Wed 04 Jul, 2007

SaWey wrote:You can find that in the function
Code: Select all
unsubscribePage($id) {

in 'index.php' at line 541


can you give some examples how we would add our own redirect page to this code ?
gspark
phpList newbie
 
Posts: 4
Joined: 10:05am, Tue 03 Jul, 2007

Re: Redirect to custom 'Thank you' page

Postby H2B2 » 6:16pm, Tue 18 Mar, 2008

phader wrote:I've created a custom subscribe page and I'd like to take the user to a certain URL after they registered, instead of the default thank you page. How do I do that?
Spamcollect developed a mod for redirecting to a custom subscribe, unsubscribe and preferences page. See: viewtopic.php?t=16808

EDIT:
And dimasko suggests this mod:
dimasko wrote:subscribelib2.php file line 297

something like:
Code: Select all
# personalise the thank you page
  if ($subscribepagedata["thankyoupage"]) {
    //$thankyoupage = $subscribepagedata["thankyoupage"];
   header("location: link");
  } else {
    //$thankyoupage = '<h3>'.$strThanks.'</h3>'. $strEmailConfirmation;
   header("location: link");
  }
works for me :D
ref: viewtopic.php?p=60737#p60737
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: Redirect to custom 'Thank you' page

Postby ncube » 9:23pm, Mon 07 Apr, 2008

H2B2 wrote:
phader wrote:I've created a custom subscribe page and I'd like to take the user to a certain URL after they registered, instead of the default thank you page. How do I do that?
Spamcollect developed a mod for redirecting to a custom subscribe, unsubscribe and preferences page.


Has anyone gotten spamcollects mod to work with version 2.10.5? I messed around with the index.php, but the code on spams' site and the code in 2.10.5 are not the same.

Line 575:

Code: Select all
 $res = '<title>'.$GLOBALS["strConfirmTitle"].'</title>';
  $res .= $data["header"];
  $res .= '<h1>'.$info.'</h1>';
  $res .= $html;
  $res .= "<P>".$GLOBALS["PoweredBy"].'</p>';
  $res .= $data["footer"];
  return $res;
ncube
phpList newbie
 
Posts: 1
Joined: 9:17pm, Mon 07 Apr, 2008

Postby MiloS-SerbiA » 10:14pm, Wed 23 Apr, 2008

I've managed to create a custom thank you page, but now since I want to add another newsgroup that is now a problem since I want another custom page and it seems that is not possible?
MiloS-SerbiA
phpList newbie
 
Posts: 4
Joined: 10:10pm, Wed 23 Apr, 2008

Postby jdiff » 4:43am, Tue 03 Feb, 2009

I just went through this exercise for the new version 2.10.9. Here’s the update with proper line numbers for this version:

For the custom landing page after the user clicks the confirmation link in the confirmation email:

In /lists/index.php, comment out the following lines (576-581):

Code: Select all
$res = ".$GLOBALS["strConfirmTitle"].";
$res .= $data["header"];
$res .= ".$info.";
$res .= $html;
$res .= "".$GLOBALS["PoweredBy"].";
$res .= $data["footer"];


Add in the following line immediately after these lines:
Code: Select all
$res = header(’Location: URL to thanks-for-confirming-your-subscription page‘);



In other words, make it look like this:

Code: Select all
/* $res = ".$GLOBALS["strConfirmTitle"].";
$res .= $data["header"];
$res .= ".$info.";
$res .= $html;
$res .= "".$GLOBALS["PoweredBy"].";
$res .= $data["footer"]; */
$res = header(’Location: URL to thanks-for-confirming-your-subscription page‘);



(Replace URL to thanks-for-confirming-your-subscription page with the actual URL. Note the single quotation marks. If you use double quotation marks, it will not work, because everything after the // in the URL will be treated as a comment.)

For the custom landing page after the subscribe form is filled out:

In /lists/admin/subscribelib2.php, comment out lines 299 and 301, and add lines immediately after these lines, so the section now looks like this:

Code: Select all
# personalise the thank you page
if ($subscribepagedata["thankyoupage"]) {
// $thankyoupage = $subscribepagedata["thankyoupage"];
header(’Location: URL to thanks-for-subscribing page‘);
} else {
// $thankyoupage = ".$strThanks.". $strEmailConfirmation;
header(’Location: URL to thanks-for-subscribing page‘);
}


(Note that you are adding the same line twice, once after line 299 and once after line 301. Also note again the single quotes.)

I’m having a tough time figuring out the unsubscribe custom landing page. I think the code is somewhere areound here:

Code: Select all
if ($userid)   
      $res .= '<h1>'.$GLOBALS["strUnsubscribeDone"] ."</h1><P>";
// $res = header(’Location: URL to unsubscribe confirmation page‘);

    #0013076: Blacklisting posibility for unknown users
    if ($blacklist)
      $res .= '<h1>'.$GLOBALS["strYouAreBlacklisted"] ."</h1><P>";
    $res .= $GLOBALS["PoweredBy"].'</p>';
    $res .= $data["footer"]; 
//$res = header(’Location: URL to unsubscribe confirmation page‘);
    return $res;


Things get complicated here compared to spamcollect's directions because of the blacklist check code. Anytime I uncomment my lines and comment out the lines directly above them, it completely breaks my custom subscribe and confirm landing pages! So without a lot of random trial and error, I'm stumped.
jdiff
phpLister
 
Posts: 5
Joined: 4:29am, Tue 03 Feb, 2009

reply

Postby ecptime » 2:45am, Thu 05 Feb, 2009

Nice work!
I have tried the SpamCollect mod it works for the thankyou page fine but the unsubscribe page doesn't work in 2.10.8 or .9 , it seems you can modify thankyou page and subscribe page throught the config page, just design the page in a html editor and insert into header and footer areas of the page.
If you have any luck with that Damm UNSUBCRIBE page please let us know, there have been numerous posts about this,
It would be really nice if the developers were to add a Unsubscribe page template to the Subscribe page area.

Cheers
Dan
ecptime
PL Nut
 
Posts: 20
Joined: 12:38am, Wed 28 Jan, 2009

Postby jdiff » 2:55am, Thu 05 Feb, 2009

Modifying these pages can be done in config but this mod is useful when you are trying to use phplist within a CMS such as Joomla. My original setup was just the customized html inside of an IFRAME, but the custom code mod here allows me to put the subscribe form onto an actual Joomla page itself which is much nicer.

I am not sure why the unsubscribe page is so much trouble. The blacklist code in there is certainly part of the issue, since the code is now so different from spamcollect's mod. I'll keep working on it.
jdiff
phpLister
 
Posts: 5
Joined: 4:29am, Tue 03 Feb, 2009

Next

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests