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)

$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

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

  1. Johnny says:

    Hi, can you please make an update for using this example in phpList 2.10.11 or .12, I tried to follow the example and I get an error: “Parse error: syntax error, unexpected ‘:’ in /home/site/public_html/list/index.php on line 676″
    The line number for latest phpList version is not the same but you can easily find the code which I edited to read:

    if ($userid)
    /* $res .= ”.$GLOBALS[“strUnsubscribeDone”] .””;

    #0013076: Blacklisting posibility for unknown users
    if ($blacklist)
    $res .= ”.$GLOBALS[“strYouAreBlacklisted”] .””;
    $res .= $GLOBALS[“PoweredBy”].”;
    $res .= $data[“footer”];
    (next line676: ) */
    $res = header(”Location: http://www.adxpay.com/confirmation”);
    return $res;

  2. yvette says:

    Still no one got a solution to a custom thankyou page and unsubscribe page in the newest version?
    I am completely lost, the lines are all different, and the code is all different….

  3. Frederick says:

    I’m also trying to get a newer version: 2.10.13 to redirect to and from custom Unsubcription and Preferences forms and to have the confirmations just be pop-up windows. Any help would be great. As has been stated the new version is not compatible with the code shown here thus far.
    Please, Please, Please an update would help so many I’m sure.
    How do I mod the following new code to work?

    function unsubscribePage($id) {
    global $data, $tables;
    $res = ”.$GLOBALS[“strUnsubscribeTitle”].”.”\n”;
    $res .= $data[“header”];

    if (isset($_GET[“uid”])) {
    $req = Sql_Query(“select * from $tables[user] where uniqid = \””.$_GET[“uid”].”\””);
    $userdata = Sql_Fetch_Array($req);
    $email = $userdata[“email”];
    if (UNSUBSCRIBE_JUMPOFF) {
    $_POST[“unsubscribe”] = 1;
    $_POST[“email”] = $email;
    $_REQUEST[‘unsubscribeemail’] = $email;
    $_POST[“unsubscribereason”] = ‘”Jump off” set, reason not requested’;
    }
    } else {
    if (isset($_REQUEST[‘unsubscribeemail’])) {
    if (UNSUBSCRIBE_JUMPOFF) {
    $_POST[“unsubscribe”] = 1;
    $_POST[“unsubscribereason”] = ‘”Jump off” set, reason not requested’;
    }
    $email = $_REQUEST[‘unsubscribeemail’];
    } else {
    if (isset($_REQUEST[’email’])) {
    if (UNSUBSCRIBE_JUMPOFF) {
    $_POST[“unsubscribe”] = 1;
    $_POST[“unsubscribereason”] = ‘”Jump off” set, reason not requested’;
    }
    $email = $_REQUEST[’email’];
    }
    }
    Thanks in advance for all your help.
    Frederick

  4. admin says:

    Hi all,

    I wrote a quick update on the hack http://www.spamcollect.com/archives/75

    Let me know if it works.

    Thanks

  5. […] 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. […]

  6. I hope its not too late to get my problem solved or helped with. Or, am I too late once again?

    Using: 2.20.13

    I know the answer is somewhere and I have been looking for the past two days. I have successfully created a custom subscription page, confirmation page,unsubscribe page, but when the the unsubscribe button is pressed I’m directed to the phpList message/page “You have been unsubscribed…” how can I direct the action of pushing the button to a custom designed page I have built?

    I know this is probably a simple fix, but I can’t seem to find it. Any help, guidance or code to copy would be greatly appreciated.

    Keeping my fingers crossed.

    PChuprina

  7. kris says:

    hello, i patcht this succesful, i also want to make a customiset admin page where the user ho createds the newsletter, can make a news letter and send it too al the registerd e-mails for this user, and a little of statistics. is this possible to do so whit my layout of my website?

    thanks

  8. maxwell says:

    how can we add target=_blank or target=_parent on the url link? can it be done? thanks!

  9. […] have to say I am also quite surprised that the PHPList Hack is since years the most popular one I have wrote. Seems like the system is used widely but not as […]

  10. template says:

    hello there and thanks on your information ? I’ve definitely picked up anything new from right here. I did however expertise some technical issues the use of this web site, as I skilled to reload the site lots of times previous to I could get it to load correctly. I have been puzzling over in case your web host is OK? Not that I am complaining, but slow loading instances times will very frequently affect your placement in google and can damage your quality rating if ads and marketing with Adwords. Anyway I am adding this RSS to my e-mail and can look out for much extra of your respective exciting content. Make sure you replace this once more very soon..

  11. smart phones says:

    Hi, after reading this amazing post i am too cheerful to share my knowledge
    here with friends.

  12. Garland says:

    It’s far better authenticate which choices are open to anyone before requesting a drawback.

  13. Slubne, says:

    weselne

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

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: