[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.

Postby spiro » 7:19pm, Wed 11 Mar, 2009

Hi Jdiff

Thanks for sharing the updated info on the custom landing pages, relevant to 2.10.9.

I further tweaked the one for confirming the email link once clicked, to parse some variables to the custom landing page.


mails/index.php

aprox. around line 544

added the id field, highlighted with ** to the select part of the following code;

Code: Select all
$req = Sql_Query(sprintf('select id**,name,description from %s list, %s listuser where listuser.userid = %d and listuser.listid = list.id and list.active',$tables['list'],$tables['listuser'],$userdata['id']));


Then added a line to create a pipe delimited string of list id's that the user has subscribed to.

find the following line of code around 550
Code: Select all
$html .= '<li>'.stripslashes($row["name"]).'<div>'.stripslashes($row["description"]).'</div></li>';


and added the following line;

Code: Select all
$listids .= stripslashes($row["id"]).'|';



add an outcome flag variable in the following two places.

find the following line of code around 570
Code: Select all
$info = $GLOBALS["strConfirmInfo"];


and added the following line;

Code: Select all
$regemailoutcome = "success";


find the following line of code around 574
Code: Select all
$info = $GLOBALS["strConfirmFailInfo"];


and added the following line;

Code: Select all
$regemailoutcome = "fail";



Then updated the header url from the mod to take you to the custom landing page from clicking the link in the subscribe email.

Code: Select all
$res = header('Location: http://www.yourdomain.co.uk/yourcustomlandingpage.php?outcome='.$regemailoutcome .'&lists='.$listids);



Then around the center of the code in my custom landing page I have put;


Code: Select all
$outcome = $_GET['outcome'];
$lists = $_GET['lists'];
$listarray = explode('|',$lists);
if($outcome == "success")
{
echo "Thank you for confirming your subscription. The newsletters you are subscribed to are listed below.<br><br>\n";

if(in_array("1", $listarray))
echo "test<br>\n";
if(in_array("2", $listarray))
echo "Title for list2<br>\n";
}
else
{
echo "Sorry, your request for confirmation was not recognised. Please make sure to use the full web address as mentioned in the email that you received. Sometimes this web address wraps onto multiple lines.\n";
}


This now allows me to have several lists available on my custom subscribe page and display a dynamic custom confirm page. Just need to add addititional nested if statements within the success if statement for each additional list id that you wish to echo to the confirm page.

Has there been any success with the custom unsubscribe and preference pages?

Regards
Spiro
As of July 2011
using the following on a shared Linux host:


PHPList: v2.10.14,FCKeditor: 2.6.3 (as distributed with phpList),PHP: 5.2.14,PHPMailer: ??,Apache: 2.2.11with OpenSSL enabled.
spiro
PL Geek
 
Posts: 50
Joined: 7:37pm, Thu 29 Jan, 2009

multiple List thankyou pages

Postby jbg00d2 » 4:19pm, Tue 17 Mar, 2009

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?


Hello

I have multiple lists and need different thankyou pages. This method seems like it will work using the header()call, but not sure where to put it? Where exactly would the header()call go given my circumstance?

I have this in place in the subscribelib2.php

# personalise the thank you page
if ($subscribepagedata["thankyoupage"]) {
$thankyoupage = $subscribepagedata["thankyoupage"];
} else {
$thankyoupage = '<h3>'.$strThanks.'</h3>'. $strEmailConfirmation;
}

Thanks for the help.
jbg00d2
phpLister
 
Posts: 6
Joined: 3:42pm, Tue 17 Mar, 2009

Re: Redirect to custom 'Thank you' page

Postby gibble » 2:04pm, Tue 09 Jun, 2009

I've managed to get a custom 'Thank You', 'Confirmed', 'Unsubscribe', 'Unsubscribe Successful', 'User not found', and 'Request Preferences' page

Thank You Page
FILE: ../lists/admin/subscribelib2.php

LINES: 338 and 341
CHANGES:
Set $thankyoupage equal to a header redirect

ex:
Code: Select all
$thankyoupage = header("Location: http://".$_SERVER['SERVER_NAME']."/test/thanks.htm");


Do this for both instances


Confirmed Page

FILE: ../lists/index.php

LINES: 583
CHANGES:
right before the "return $res" set $res equal to a header redirect
ex:
Code: Select all
$res = header("Location: http://".$_SERVER['SERVER_NAME']."/test/confirmed.htm");
             return $res;



Unsubscribe
FILE: ../lists/index.php

LINES: 707
CHANGES:
right before the "return $res" $res equal to a header redirect
ex:
Code: Select all
$res = header("Location: http://".$_SERVER['SERVER_NAME']."/test/unsubscribe.htm");
             return $res;


LINES: 749
CHANGES:
right before the "return $res" $res equal to a header redirect
ex:
Code: Select all
$res = header("Location: http://".$_SERVER['SERVER_NAME']."/test/unsubscribe.htm");
             return $res;




Unsubscribe Successful
FILE: ../lists/index.php

LINES: 671
CHANGES:
Below "if ($userid)" set $res equal to a header redirect
ex:
Code: Select all
if ($userid)
            $res = header("Location: http://".$_SERVER['SERVER_NAME']."/test/unsubscribe_success.htm");



User not found
FILE: ../lists/index.php

LINES: 653
CHANGES:
Above "logEvent(..." set $res equal to a header redirect
ex:
Code: Select all
$res = header("Location: http://".$_SERVER['SERVER_NAME']."/test/user_not_found.htm");
             logEvent(...




Request Preferences
FILE: ../lists/index.php

LINES: 328
CHANGES:
Above "return $html" set $html equal to a header redirect
ex:
Code: Select all
 $html = header("Location: http://".$_SERVER['SERVER_NAME']."/test/request_preferences.htm");
              return $html;



Note: All the line numbers are approximates since I'm sure I've changed more than I realise, and this is with version 2.10.10

What I'd like help with is a Custom Preferences Page, and Blacklisted Page as I can't seem to get either of those to work.

(Edited to add custom Request Preferences)
gibble
phpList newbie
 
Posts: 4
Joined: 1:40pm, Tue 09 Jun, 2009

Re: Redirect to custom 'Thank you' page

Postby jwgrafflin » 6:45pm, Mon 22 Jun, 2009

My custom thank you page is located at http://www.mysite.com/thanks.html. What would I put in this code line to use that page? In other words, what should this code line look like after it is edited for the above information?

Code: Select all
$thankyoupage = header("Location: http://".$_SERVER['SERVER_NAME']."/test/thanks.htm");
jwgrafflin
PL Nut
 
Posts: 34
Joined: 12:48pm, Mon 02 Jul, 2007
Location: Texas, USA

Re: Redirect to custom 'Thank you' page

Postby gibble » 1:18pm, Thu 25 Jun, 2009

jwgrafflin wrote:My custom thank you page is located at http://www.mysite.com/thanks.html. What would I put in this code line to use that page? In other words, what should this code line look like after it is edited for the above information?

Code: Select all
$thankyoupage = header("Location: http://".$_SERVER['SERVER_NAME']."/test/thanks.htm");


you would put

Code: Select all
$thankyoupage = header("Location: http://www.mysite.com/thanks.html");
gibble
phpList newbie
 
Posts: 4
Joined: 1:40pm, Tue 09 Jun, 2009

Re: Redirect to custom 'Thank you' page

Postby jwgrafflin » 3:56am, Fri 26 Jun, 2009

Regarding the unsubscribe function in list/index.php, in ver 2.10.10 that code starts at 577. There are 3 return $res statements in that section of code. To use a custom unsubscribe page, I find adding
Code: Select all
$res = header("Location: http://www.mysite.com/unsubscribe.php");

just before any of those lines redirects to my custom page. However, the email address does not carry forward. Is it possible to use a custom unsubscribe page and maintain the full functionality of the code?
jwgrafflin
PL Nut
 
Posts: 34
Joined: 12:48pm, Mon 02 Jul, 2007
Location: Texas, USA

Re: Redirect to custom 'Thank you' page

Postby gibble » 11:48am, Mon 29 Jun, 2009

I've actually managed to do this by checking $_REQUEST for the email address and if I find it I add it to the redirect ... I don't have the code with me but it was something like

Code: Select all
$_REQUEST['email'] ? $get='?email='.$_REQUEST['email'] : $get = '';
$res = header("Location: http://www.mysite.com/unsubscribe.php".$get);


I've done this several times to pass data to my custom pages and it works

EDIT: actually check out http://forums.phplist.com/viewtopic.php?f=6&t=25092 it's almost the same as my post above but covers all the customizations that I did
gibble
phpList newbie
 
Posts: 4
Joined: 1:40pm, Tue 09 Jun, 2009

Re: [mod] Redirect to custom 'Thank you' page

Postby sol001 » 12:08pm, Tue 08 Sep, 2009

Hi - I've been pulling my hair out over this one.... can't crack it... :oops:

I'm using version 2.10.10

I have successfully incorporated a number of custom pages into my site that work great when the user is actually signing up including custom thanks and confirm pages. :D

What I would like help with is customising the pages that are clicked on in the email links. Specifically these two:

To update your details and preferences please go to http://mysite.com/lists/?p=preferences&uid=1234etc.


If you do not want to receive any more messages, please go to http://mysite.com/lists/?p=unsubscribe&uid=uid=1234etc.


RE the unsubscribe page: I followed your advice above, and in lists/index.php, - before return $res; around line 730 and around 780, I added

Code: Select all
//Custom unsubscribe link code starts
             $get='';

             if ($_REQUEST['uid'])
             {
                $get.= '&uid='.$_REQUEST['uid'];
             }

$html = header("Location: http://".$_SERVER['SERVER_NAME']."/unsubscribe.php?p=unsubscribe".$get);
//Custom unsubscribe link  code ends


I also tried :
Code: Select all
$res = header("Location: http://".$_SERVER['SERVER_NAME']."/unsubscribe.php");


... and several other variations! I also tried the same for the preferences link.

None of these code snippets seem to work for me. :cry:

When clicking on the email link, the actual unsubscribe.php page displays ok - and the unsubscribe link and UID data is correctly displayed in the URL, but the page itself is blank! :roll:

Do I have to put some code in that page? Or do I need to make a mod elsewhere? Or is my code above just wrong! :?:

Your Help GREATLY appreciated :-)
sol001
PL Nut
 
Posts: 18
Joined: 9:20am, Fri 22 Feb, 2008

Re: [mod] Redirect to custom 'Thank you' page

Postby stacef » 2:07pm, Wed 30 Sep, 2009

I hope someone can share the magic recipe to making custom pages work. I've been working from the only two posts I can find with any real info ( this one and http://forums.phplist.com/viewtopic.php?f=6&t=25092) but several ingredients seem to be missing. While the code mods seem to work, I'm still a bit hazy on url settings(?p=subscribe or mysite.com/test/subscribe) and code to be placed on my custom pages

I've been successful so far in setting up my subscribe pages (subscribe, thank you and confirmed) and unsubscribe pages (unsubscribe and unsubscribe successful). Everything functions as normal when going to the Subscribe or Unsubscribe pages directly. In other words, if I go to mysite.com/test/subscribe and subscribe, I get my custom thank you page and an email with a link to confirm. If I click the link, I get my confirmed page and the welcome email. Same for going directly to mysite.com/test/unsubscribe.

Where I'm currently stumped is in making this all work from the mysite.com/test/sub/unsub links included in the emails so that the users email address is included.

PHPList configuration page:
all urls still set to www.[DOMAIN]/lists/?p=subscribe, www.[DOMAIN]/lists/?p=unsubscribe, etc

Subscribe page:
No mods to lists/index.php, java and form code added to mysite/com/test/subscribe, according to PHPList docs

Thank You page:
Mod to lists/admin/subscribelib2.php adding header redirect, per this post; nothing but thank you text added to mysite.com/test/thanks

Confirmed page:
Mod to lists/index php adding header redirect, per this post; nothing but confirmed text added to mysite.com/test/confirmed

Unsubscribe page:
Mod to lists/index.php, adding two header redirects per this post. Not sure what to add to mysite.com/test/unsubscribe. I added some form code but I don't think it's correct:
Code: Select all
<input type=text name="unsubscribeemail" value="" size=40>
I think value needs to be set to something to get the user email address prefilled when coming from an email link. Otherwise, if you manually enter the address, the page functions as it should.

Unsubscribe Successful page:
Mod to lists/index.php, adding the header redirect, per this post; nothing but unsub success text added to mysite.com/test/unsubconfirmed

I haven't tackled preferences yet but I think it will go OK, once I get subscribe and unsubscribe working as desired.

I've been going trial and error on this for a couple of weeks now and feel like I'm banging my head against the wall. Someone must have successfully integrated this whole process in to their site; please help me - all of us - and share your wisdom!

Thanks
stacef
phpLister
 
Posts: 9
Joined: 10:02pm, Wed 16 Sep, 2009

Re: [mod] Redirect to custom 'Thank you' page

Postby sol001 » 11:50pm, Wed 30 Sep, 2009

Hi

Like you I spent about 2 weeks tinkering with various files, code and settings to try to get this to work. Unfortunately, I came to the conclusion that while some pages were working fine (thank you page, subscribe page and unsubscribe page) other pages would not work - particularly the preferences and forward to pages, and the links in the emails were not parsing correctly to the site.

In the end, I just settled with having the entire newsletter outside of my main site, but linking to the site's main CSS file which at least enable me to have the same background, font settings and sizes / colours etc.

I believe right now there is no sure way of integrating PHPlist into your site - I even tried with iframes but had no luck!

What is required is for someone who has achieved full integration to provide a detailed write up. I would have done this had I been successful.

If you have the time - keep at it - you might find the solution - but the support on this forum is pretty centered around basic questions (such as how do I make a subscribe page!) - so I don't think you will get much support on the issue.

Another issue is that since the release of the new version - a lot of the main source code has changed - and so what worked back then may not work now (that's my experience!)

You may also find this URL useful:
http://forums.phplist.com/viewtopic.php?f=6&t=8940&p=67896#p67896
[edit - sorry just realised that this URL is the same as this page! So ignore this link!]

Please keep this post updated with any progress that you make so that we can share any breakthroughs. And good luck!

Kind regards
Sol
Last edited by sol001 on 11:55pm, Tue 16 Feb, 2010, edited 1 time in total.
sol001
PL Nut
 
Posts: 18
Joined: 9:20am, Fri 22 Feb, 2008

Re: [mod] Redirect to custom 'Thank you' page

Postby setd » 8:11pm, Thu 08 Oct, 2009

So if I create a custom subscribe/thank you/unsubscribe page, will the code be 'reset' when PHP LIst is upgraded? Is there a way to make sure changes are protected?

Thanks
setd
phpLister
 
Posts: 7
Joined: 11:05am, Wed 26 Aug, 2009

Re: [mod] Redirect to custom 'Thank you' page

Postby jwgrafflin » 5:38am, Fri 09 Oct, 2009

In order to fully customize phplist and integrate it into your site, you will need to edit several files. And when the next upgrade comes out, you will need to do the edit all over again.

The files that will need editing are (to best of my recollection):
subscribelib2.php (a whole bunch of stuff here, according to your preferences)
pagetop.php (this is where you edit the DOCTYPE)
index.php
spageedit.php (set css for the "h1" tag)
/texts/english.inc (or whatever language file you use - customize the system messages page titles, etc.)

This is all in addition to editing the config.php as well as the config page within the admin area. To see a working system, visit http://www.startpagedepot.com/subscribe.php.

This is a tedious process in which you will need to fully understand how the various pages fit into the system. If you are not comfortable editing those files, then settle for just a custom subscribe page and let the system do the rest.
jwgrafflin
PL Nut
 
Posts: 34
Joined: 12:48pm, Mon 02 Jul, 2007
Location: Texas, USA

Re: [mod] Redirect to custom 'Thank you' page

Postby stacef » 1:53pm, Fri 09 Oct, 2009

jwgriffin-

Sure sounds like you've completed this successfully. I think most of us here understand the implications of editing core code but we haven't figured out all the steps necessary to completely customize the subscription process. Would you be interested in sharing in detail how you were able to make it work? There are a lot of folks looking for this info.

Thanks,
Stace
stacef
phpLister
 
Posts: 9
Joined: 10:02pm, Wed 16 Sep, 2009

Re: [mod] Redirect to custom 'Thank you' page

Postby jwgrafflin » 2:31pm, Fri 09 Oct, 2009

It will take me some time, since I started night classes this past Monday, in addition to my regular job. Plus it's over 100 miles round trip to class. I took notes while customizing, so it shouldn't be too difficult to replicate. I do have at least one more website to install a custom script on, so will note details of the steps as I go.

There's really only one custom page involved: your subscribe page. Everything else is done from within the script.
jwgrafflin
PL Nut
 
Posts: 34
Joined: 12:48pm, Mon 02 Jul, 2007
Location: Texas, USA

Re: [mod] Redirect to custom 'Thank you' page

Postby stacef » 2:45pm, Fri 09 Oct, 2009

There you go ... I've been going down a different path.

I understand the demands on your time but as this process seems pretty much undocumented, we'd all appreciate whatever you can share when you get a chance.

Thanks,
Stace
stacef
phpLister
 
Posts: 9
Joined: 10:02pm, Wed 16 Sep, 2009

PreviousNext

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests