WordPress.org

Support

Support » Plugins and Hacks » WP Super Cache, Clear Cache on Update Profile?

WP Super Cache, Clear Cache on Update Profile?

  • On http://www.rokkyuu.com, I’ve made it so that registered users can change the site’s color theme by picking a setting in a dropdown on their user profile (this switches out the stylesheet for that user). Unfortunately, the WP Cache portion of WP Super Cache caches the files for logged in users, so a user when changes her theme and updates her profile, she see the cache rather than the site with the selected theme.

    What function in WP Super Cache clears the cache? Is there a way I can call that when the user presses Update Profile? I don’t mind editing the core. Or is there a way to turn off WP Cache for logged in users?

    (on the site WP Super Cache is disabled for now)

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Any ideas?

    There’s an action that’s fired off when the profile is updated. Can’t remember what it is, but you could use that to call the function “wp_cache_no_postid”

    Perfect! That’s just what I’m looking for. I will try hooking wp_cache_no_postid to that action and see if it works.

    It works! Of course, I have to hack the core:

    adding:
    wp_cache_no_postid(0);

    after:
    do_action(‘edit_user_profile_update’);

    in the user_edit.php file will force WP Cache to clear after the User Profile is updated. Now to figure out how to add this to a plugin, or maybe the WP Super Cache Plugin itself…

    this also works in functions.php:

    add_action(‘edit_user_profile_update’,wp_cache_no_postid(0));

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP Super Cache, Clear Cache on Update Profile?’ is closed to new replies.
Skip to toolbar