WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Browser-specific protected post issues (2 posts)

  1. jcbaxter
    Member
    Posted 6 years ago #

    I recently started trying to use protected posts on my WordPress blog, and I get what seems to be a hit-or-miss problem where the page reloads after entering the password, without actually unprotecting the post.

    After a while of troubleshooting this on my own through researching these other problems, I've gotten a partial fix. Using the fix mentioned in another thread as shown below:

    Editing wp-pass.php by replacing the following line,
    setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000);
    with,
    setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH, preg_replace('|https?://(www)?|i', '', get_settings('home') ));

    this changes the cookie domain from "jamiebaxter.com" to ".blog.jamiebaxter.com"

    This now allowed Safari to view the post. However, I'm exclusively using Firefox and Camino these days and neither of these can load the protected post. I even had a friend attempt to access this from Firefox on a PC (I use a Mac) with no luck. Further testing with cookies found that Firefox and Camino are receiving these cookies prior to the hotfix I used above, but no longer receive any cookie afterwards. Even if I tell Firefox and Camino to accept any and all cookies, they never receive one.

    This is a rather aggravating issue, and my lack of PHP experiences only complicates my troubleshooting. Does anyone have any thoughts of where to go from here to eliminate this browser-specific issue? I

  2. jcbaxter
    Member
    Posted 6 years ago #

    Nevermind, I tweaked the two address for the blog since they were weird to get to work the first time under a subdomain. It seems to work fine right now, and cookies are being passed correctly to the browser.

Topic Closed

This topic has been closed to new replies.

About this Topic