WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache, Clear Cache on Update Profile? (6 posts)

  1. djquinn
    Member
    Posted 5 years ago #

    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!

  2. djquinn
    Member
    Posted 5 years ago #

    Any ideas?

  3. Donncha O Caoimh
    Member
    Posted 5 years ago #

    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"

  4. djquinn
    Member
    Posted 5 years ago #

    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.

  5. djquinn
    Member
    Posted 5 years ago #

    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...

  6. djquinn
    Member
    Posted 5 years ago #

    this also works in functions.php:

    add_action('edit_user_profile_update',wp_cache_no_postid(0));

Topic Closed

This topic has been closed to new replies.

About this Topic