Update on hacking PHPList to redirect subscription and unsubscription page

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.

9 Responses to Update on hacking PHPList to redirect subscription and unsubscription page

  1. Thanks for the timely update, must have smelt the smoke from my brain. Am still confused though.

    In list.php I found these lines:

    697 if (!$email) {
    698 $res .= “\n”;
    699 $res .= $GLOBALS[“PoweredBy”];
    700 $res .= $data[“footer”];
    701 return $res;
    702 }

    I want to add(I think: $res = header(“Location: http://[DOMAIN NAME]/unsubscribe_confirm.php”);

    Not sure where it goes, tried a few places with no success. Getting migraine. I know no guarantees, but any help, ideas, and or code to paste would be a great help.


  2. A correction to my pasted code:

    697 if (!$email) {
    698 $res .= $res .= “\n”;
    699 $res .= $GLOBALS[“PoweredBy”];
    700 $res .= $data[“footer”];
    701 return $res;
    702 }

    Still not sure where to drop in:

    header(“Location: YOURURL.com”);

    and what to comment out.

  3. admin says:


    you remove line 701 and replace it with header(“Location: http://www.mysite.com“);

    Did you try this?

  4. I tried this a few times and it does not work. Any other ideas? Any help would be appreciated. I’ve also posted this on a few forums with no answers.


  5. I found a answer that works for me at: http://bit.ly/hGPin7
    More specifically in index.php:

    657. addUserHistory($email,”Unsubscription”,”Unsubscribed from $lists”);
    658. $unsubscribemessage = ereg_replace(“\[LISTS\]”, $lists,getUserConfig(“unsubscribemessage”,$userid));
    659. sendMail($email, getConfig(“unsubscribesubject”), stripslashes($unsubscribemessage), system_messageheaders($email));
    660. $reason = $_POST[“unsubscribereason”] ? “Reason given:\n”.stripslashes($_POST[“unsubscribereason”]):”No Reason given”;
    661. sendAdminCopy(“List unsubscription”,$email . ” has unsubscribed\n$reason”);
    662. addSubscriberStatistics(‘unsubscription’,1);
    663. header(“Location: http://www.[your domain]”);//redirect to custom unsubscribe message!


  6. Mitch says:

    PHPList may be a good product but if it is, why hanging around a code structure of the good old (waste) eCommerce style?
    It appears that some people have fun making something really stuffed up and over complicated, just to F888 up others … Sorry, but this impression I get with a lot of open source stuff. Then you’r stuck and need there (super expensive apprenticeship professionalism) and they still would stuff it up so you keep coming back loading their pockets with your money.
    It sucks!
    I tried to implement PHPList into my design… impossible unless you’re willing to hack this stupid code on a thousand places … by that time you can write your own!

    Have fun hacking some piece of crap to get even more crap.

  7. sebek says:

    Patrick I0ve tried your fix but when i click on unsubscrube button i get redirected to default phplist unsubscribe page.

    I would just like to remove all the phplist logos (removed from footer.inc an in admin section, but doesn’t work also) and links or to redirect to custom page when user unsubscribes.

  8. Ian says:

    I’ve been searching for a way to customize the preferences page as well.

    After looking at the code on the page and the errors I got while testing I determined that it was too complicated to try and fix (for me). I think that the preferences page is generated by a php script that inputs a “password” into the submit form. Without the password a user can’t change their info. To customize the preferences page you would have to add the php code that generates the password to your page.

    It’s not impossible (maybe?), in theory you could just find the part of the code that generates the password and paste that into your page. Doing that seems like more trouble than it’s worth. I seriously doubt that the preferences page will ever get used so why bother?

Leave a Reply

Your email address will not be published. Required fields are marked *

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