WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache caching comment moderation response (10 posts)

  1. John Keegan
    Member
    Posted 6 years ago #

    We're seeing a problem when WP Super Cache is used with comment moderation.. Some pages created by WP Super Cache are being created containing the response page after someone submitted a comment, so we see a page served containing the <!-- super cache --> tag with some other user's moderated comment; the page shows the comment to be moderated with the "Fred Says: Your comment is awaiting moderation." text embedded in it. I confirm that the supercached page does indeed have that embedded in it by examining the page in the supercache directory...

    How do we get supercache to stop caching the page returned after an anonymous user submits a comment which gets moderated?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    This line in the .htaccess is supposed to prevent that from occuring:
    RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$

  3. John Keegan
    Member
    Posted 6 years ago #

    We've had that line in .htaccess and in httpd.conf and it does not seem to be preventing this from occuring ...

  4. John Keegan
    Member
    Posted 6 years ago #

    And isn't that line only there to determine whether or not to show an end user the super-cached version of the page or not? I can't see how that line would affect what content is saved to the supercache directory.

    See what I mean? The anonymous user submits their comment and the page returned by WordPress is cached if no supercache version existed... What wp-super-cache is not taking into account is that the page was not a "generic" version of the page but a page only created for that one user who submitted the comment that was sent into moderation...

  5. Donncha O Caoimh
    Member
    Posted 6 years ago #

    Are you using an AJAX powered comment form?

  6. John Keegan
    Member
    Posted 6 years ago #

    Nope, just using the standard method...

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    See what I mean? The anonymous user submits their comment and the page returned by WordPress is cached if no supercache version existed... What wp-super-cache is not taking into account is that the page was not a "generic" version of the page but a page only created for that one user who submitted the comment that was sent into moderation...

    No, I don't get that. The comment submission goes to the wp-comments-post.php file, which stores the comment. the cache plugin sees this and invalidates those pages (both super cache and wp-cached version). wp-comments-post returns cookies and a redirection to redirect the user back to the post page.

    So when the page reloads, it's regenerated, except now the user has the comment_author_ cookie set for them. This triggers it to not send the super cached version, and instead to pass through to the normal wp-cache logic, which generates the page for that particular user. Only that user should see their comment in moderation, because they're the only ones with that particular cookie. The super cache, when it's built, won't be sent to anybody with the comment_author_ cookie. Because it can't be built with that cookie being sent, the comment in moderation can't get sent to the super cached page.

    At least, that's how it's supposed to work.

  8. John Keegan
    Member
    Posted 6 years ago #

    Thanks for the info, Otto. But unfortunately it doesn't appear to be working that way.

    Is it possible that WordPress and supercache generate a supercache page in response to the comment submission, then the client is sent to the wp-cache version based on his cookie?

    I.e. - the client who submitted the comment is indeed sent to the correct version of the page but in the meantime a supercached version was created based on that submission? That the issue is that the supercached page gets built -in response- to the comment submission even if it is not the page sent to that original client that submitted the comment?

    Because the issue is not with the original client, Otto, it is that the comment moderation message is built into some server response that gets supercached and subsequent non-cookied users see that response...

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Hmm... I'll have to look at the comment code in more detail to answer that one.

  10. John Keegan
    Member
    Posted 6 years ago #

    So is anyone else seeing this or have an explanation? We're still seeing supercached pages contain that comments which were supposed to have been moderated and are listed with "Your comment is awaiting moderation"..

    I appreciate Otto42s help, but the issue can not possibly have to do with the rewrite rules, as those rules only govern who should see the supercached pages and do not relate to what content gets supercached...

Topic Closed

This topic has been closed to new replies.

About this Topic