WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Super cache and user ratings

[Resolved] Super cache and user ratings

  • bosniamaj
    Member

    @bosniamaj

    Hello,

    I am wondering if I can make this working with WP Super Cache:
    I need to have user rating system which i built without plugins, and I really like WP Super Cache, but I have some problems.
    I can’t figure out how to display right data when the content is cached.

    So, if user votes on the post, vote count is the same until the cache refreshes automatically.

    Any ideas to make this working properly? Maybe some solution like flushing the cache when the rating changes, or something like that?

    P.S. I am using mod_rewrite to serve the cache.

    Thanks.

    http://wordpress.org/extend/plugins/wp-super-cache/

Viewing 1 replies (of 1 total)
  • bosniamaj
    Member

    @bosniamaj

    I managed to resolve this by using wp_cache_post_change($post_id).

    So, for all of you in need for similar solution, this is my code:
    When user votes, the vote is registered by ajax post, and the function that registers it calls this one:

    function my_clear_cache_for_post($post_id)
    {
        global $cache_path;
        if(function_exists("wp_cache_post_change"))
        {
            $GLOBALS["super_cache_enabled"]=1; /* in the documentation it says it may be necessary */
            wp_cache_post_change($post_id);
        }
        return false;
    }

    EDIT 1: I stumbled into this post, and it seems to be the same problem, and the same solution, but I couldn’t google it out, sorry for posting duplicate content 🙁

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Super cache and user ratings’ is closed to new replies.