Support » Plugin: WP Super Cache » [Plugin: WP Super Cache] Make known users anonymous breaks auth comments

  • Hi. I am working on a site that forces people to register to make a comment, and so therefore, there are lots of registered users that are browsing the site.

    As I understand it, “don’t cache pages for known users” should always be checked, ie. I’m not even sure why it is an option to uncheck it, but I suppose someone asked somewhere along the way.

    I would like to check the box that says “make known users anonymous” which fixes the caching for reading, and I have some javascript that does the right thing for showing the authenticated comment box, whether you are logged in or not, etc.

    But, I was surprised to find out that supercache is removing the wp_logged_in_XXX cookie when POSTing to wp-comments-post.php. I think that behavior should be changed.

    I am not familiar enough with wordpress to know if there are other pages that shouldn’t ever be made anonymous, but I think it would be safe to add that check in wp_supercache_cache_for_admins().

    I haven’t tried it yet, but I’m thinking it is just a:

    if($_SERVER["REQUEST_URI"] == "/wp-comments-post.php")
       return $cookies;

    sort of thing.

    Does that make sense?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Donncha O Caoimh


    Yeah, that’s a great idea. Thanks. I’ll add something like that in.

    Plugin Author Donncha O Caoimh


    Instead of that, and trying to second guess what people want I added a filter, ‘wp_supercache_remove_cookies’ that if it returns false the cookies won’t be removed.

    Try the development version:

    Thanks for getting back to me so quickly – since it was mostly working without the feature, I was no longer in super-critical mode, but getting back to it now.

    I’m checking out your changes now, and I’m happy to see the change from HTTP_HOST to SERVER_NAME, as I occasionally got weird cached files due to that (mostly due to case-sensitivity problems). I see the stuff about multi-site, and so in the places that you still use HTTP_HOST, you might considering running a strtolower() on it.

    I’ll check out the filter feature shortly.

    I’m getting a really weird error that I can’t figure out what the problem is.

    As soon as I enable the “make pages anonymous” check box, I get a 500 error, and nothing is reported in the apache logs, which I’ve never seen before. I see the 500 error in the access.log, but nothing in error.log, and nothing on the website, even if I turn on display_errors.

    Just content-length: 0.

    I tried replacing the “true” in the apply_filters call with $notused, and setting $notused to ” prior to calling apply_filters, but that didn’t help (I was thinking that maybe since the function expects to be able to modify that parameter, maybe you aren’t allowed to pass in such base constructs like a boolean, though I see you do that one other in a filter.

    I removed the if() statement, and just had a line that said apply_filters('...', true);

    and I can reliably generate the 500 error by uncommenting that line, and fixing it by commenting. I am at a loss as to what is happening, and I’m working on a semi-live/beta site, so I’m trying to not have it down for too much.

    I did write a test.php that includes wp-config.php and called it from the command line, and don’t see any problems, and I’ve since removed all of the code that I wrote: add_filter(), and the associated remove_cookies function that was called as a filter.

    I’m not sure where to go from here. It seems like it is a syntax error in the apply_filter line, though I don’t know why the php engine isn’t outputting an error. Maybe I’ll try manually retyping those couple lines, if there is a funny character in it or something.

    Hi all,

    Am getting the fatal error that jondaley describes too.

    Apparently the WP apply_filters function isn’t defined yet (file not included yet).

    Any solution for this?


    Plugin Author Donncha O Caoimh


    It’s working in the development version now. Go grab it from

    Hi Donncha,

    Thanks for your response!
    Tried the development version and indeed works.

    Am wondering about something else related to this though now:
    By checking this option, known user are made anonymous by unsetting a cookie if i’m correct, right?
    But i’m wondering, what i want in most case, is to serve the same cached page to anonymous users as i do to known users.
    Some pages however i don’t want cached and i use DONOTCACHEPAGE in my page template. These pages i use for membership kind of areas on the front-end.
    With the ‘make know user anonymous’ option checked however, i’m now unable to show these pages, cause the user appears to be logged out. But when i enter the wp-admin, i can.

    Hope i make myself clear and you understand.

    Is there anyway to make this scenario of mine work?


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WP Super Cache] Make known users anonymous breaks auth comments’ is closed to new replies.