Restart - Automatic Email Unsubscribe Link Broken

David asked me to restart this thread. Old thread was here:
https://premium.wpmudev.org/forums/topic/automatic-email-unsubscribe-link-broken

Notes:
- I was the last to post in the old thread, but another poster actually started that thread.
- My debug started with what is still the latest version.
- Starting this thread with my first message in original.

Just started testing this on a local install. Got an initial e-mail to go out fine.

When a user clicks on unsubscribe link, they are directed to a page such as:

http://www.mydomain.tld/unsubscribe/d90c321d75832...

This page doesn't exist - blank page within my template. There is no e-mail message delivered to user to let them know that they unsubscribed.

Also curious which field in which table controls the status of whether the user is subscribed or not?

- Scott

  • Barry
    • DEV MAN’s Mascot

    What are your permalink settings? Can you visit the settings -> permalinks page in your admin area and refresh them and then see if the unsubscribe link works. It should redirect back to the sites home page if the permalink is working correctly.

  • BlueSkies
    • Site Builder, Child of Zeus

    Hi Barry,

    I had tried that suggestion in the old thread. Here is what I found (copied from that thread):

    Permalinks
    ================
    I went to the permalink area under Settings. I changed to Default (saved) and then back to Month and name (with another save) - is this what you mean by refreshing? There was no change in the behaviour.

    Attempted fix
    ====================
    I thought I had found the problem, but maybe it goes deeper than my fix attempt.

    In class.automessage.php there is the line:
    if($blog_id == 1 || !is_multisite()) {

    My main blog (www.mydomain.tld) is blog id 3. I tried substituting 3 for 1 in the code above, but that didn't change anything. Is that hardcoded number (1) correct? If not, is there other code that assumes the main blog is id=1?

    Log
    ==================
    Nothing in error_log, but the access_log shows that /unsubscribe results in a 404 response:

    192.168.1.3 - - [14/Jan/2011:13:05:01 -0500] "GET /unsubscribe/d455e5d2f9c105c30a0cc3147840581a HTTP/1.1" 404 10048
    192.168.1.3 - - [14/Jan/2011:13:05:03 -0500] "GET /?mcsf_action=main_css&ver=3.0.4 HTTP/1.1" 200 556

    I'm happy to keep digging if you could point me to some things to try (insert debug messages in plugin, etc).

    httpd.conf, .htaccess
    ===========================
    FYI - I don't use local .htaccess files, instead my rewrite rules are in httpd.conf since I read that performance was better. The relevant section from httpd.conf is:

    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

    RewriteEngine On
    RewriteBase /

    RewriteRule ^index\.php$ - [L]

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

    - Scott

  • Mason
    • DEV MAN’s Sidekick

    Hiya Scott,

    Have you tried this on a live server? It does sound like something in the site environment/setup.

    I've tested this locally and on live servers and it's working correctly in both instances. Still, maybe Barry will have another suggestion, but if it's 404ing that's a redirect issue at some level.

    Thanks!

  • Barry
    • DEV MAN’s Mascot

    Do you have access to your db? In your options table for the main blog there should be an entry called rewrite_rules (or similar) with a large amount of gibberish in it :slight_smile:

    Can you either post that here, or put it in a text file and attach it to a reply?

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.