Archive for the phplist Category

Update on hacking PHPList to redirect subscription and unsubscription page

Wednesday, April 13th, 2011 | Permalink

About 4 years ago I wrote a post about hacking PHPList to redirect the subscribe and unsubscribe pages. It is one of the most read articles on my blog. And has around 50ish comments right now. It seems like there is still a high demand for a solution.

I didn’t do much work with PHPlist since then, but from looking at the current version 2.10.13 I would assume the following works.

Please be aware that this is totally untested and just a guess. So if anyone could test this and comment here, I would appreciate it.

Code has changed a lot since I have downloaded the project the last time. There are now functions instead of spaghetti code. To be fair, there is still a lot of spaghetti code. Anyway I still think PHPList is an awesome product. Especially as an open source solution.

Seems like the structure is till the old one. All main functions are located in lists/index.php.

For the subscribe page go to line 404 and look for:

function subscribePage($id) {

This leads you to the function that is generating the subscribe page.

Looking for the line 525 there is a

return $html;

Remove that line and replace it with a

header("Location: YOURURL.com");

For the confirmation page go to line 528:

function confirmPage($id) {

Look for return $res; in line 580.

Comment it out or remove it and replace it with the header redirect.

Finally go to line 583 for the unsubscribe page.

function unsubscribePage($id) {

You will find in line 700 the

return $res;

Same procedure here.

This is only working if PHPlist is not writting a header up front.

As I mentioned in the beginning, TOTALLY UNTESTED NO GARANTUEES.

How to redirect phpList to custom subscribe and unsubscribe pages. A phpList hack!

Wednesday, August 29th, 2007 | Permalink

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)

$res = ''.$GLOBALS["strConfirmTitle"].'';
$res .= $data["header"];
$res .= '<.h1>'.$info.'<./h1>';
$res .= $html;
$res .= "<.P>".$GLOBALS["PoweredBy"].'';
$res .= $data["footer"];
return $res;


Modify it by adding the following:

$res = ''.$GLOBALS["strConfirmTitle"].'';
/*$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:


if ($userid) {
$res .= '<.h1>...'.$GLOBALS["strUnsubscribeDone"] ."<./h1><.P>";
$res .= $GLOBALS["PoweredBy"].'<./p>';
$res .= $pagedata["footer"];
return $res;
}


Change it to:


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


if ($subscribepagedata["thankyoupage"]) {
$thankyoupage = $subscribepagedata["thankyoupage"];
} else {
$thankyoupage = '<.h3>'.$strThanks.'<./h3>'. $strEmailConfirmation;
}


Modify it so it looks like:

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.

UPDATE: http://www.spamcollect.com/archives/75