• Resolved javiarques

    (@javiarques)


    Hi,
    I’m having this problem. All my cache is cleared when a user log into the web. Is there any wp hook that I have to unable?
    This is my config:
    mod_rewrite + compress + don’t cache known users + mobiles + 3600 expritaion date

Viewing 8 replies - 1 through 8 (of 8 total)
  • It shouldn’t do that. Have you tried using the debug system in the plugin to track down what the problem may be?

    Thread Starter javiarques

    (@javiarques)

    Resolved,
    It is Buddypress that clear all cache when an user login,
    the solution, remove the filter, put it into your functions.php:

    remove_action('wp_login', 'bp_core_clear_cache');

    Plugin Author Donncha O Caoimh (a11n)

    (@donncha)

    Bizarre. It looks like a drastic action to take but the original code is here.

    hi javiarques/Donna,

    Could you tell me in more detail ?
    functions.php is it located under ‘wp-includes’ ? or under theme files ?
    in functions.php where exactly I need to add this remove_action ?

    Thread Starter javiarques

    (@javiarques)

    Hi mmln,
    You just have to insert the line
    remove_action('wp_login', 'bp_core_clear_cache');
    in your functions.php located in your theme. And if you dont’t have it, just create it, and it will be called by WP.

    Thread Starter javiarques

    (@javiarques)

    This is the function created in Buddypress plugin

    /**
     * bp_core_clear_cache()
     * REQUIRES WP-SUPER-CACHE
     *
     * When wp-super-cache is installed this function will clear cached pages
     * so that success/error messages are not cached, or time sensitive content.
     *
     * @package BuddyPress Core
     */
    function bp_core_clear_cache() {
    
    	global $cache_path, $cache_filename;
    
    	if ( function_exists( 'prune_super_cache' ) ) {
    		do_action( 'bp_core_clear_cache' );
    
    		return prune_super_cache( $cache_path, true );
    	}
    }

    This function is called tons of times!!!!, and that’s an extreme solution for my huge portal el embarazo .net, with more than 3000 cached posts, and 20.000 users:

    // List actions to clear super cached pages on, if super cache is installed
    add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_remove_comment', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_remove_post', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_remove_blog_for_user', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_remove_blog', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_new_blog_comment', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_new_blog_post', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' );
    add_action( 'bp_blogs_remove_data', 'bp_core_clear_cache' );
    
    add_action( 'wp_login', 'bp_core_clear_cache' );
    add_action( 'bp_core_render_notice', 'bp_core_clear_cache' );
    
    add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' );
    add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
    add_action( 'bp_forums_new_post', 'bp_core_clear_cache' );
    
    add_action( 'friends_friendship_rejected', 'bp_core_clear_cache' );
    add_action( 'friends_friendship_accepted', 'bp_core_clear_cache' );
    add_action( 'friends_friendship_deleted', 'bp_core_clear_cache' );
    add_action( 'friends_friendship_requested', 'bp_core_clear_cache' );
    
    add_action( 'groups_join_group', 'bp_core_clear_cache' );
    add_action( 'groups_leave_group', 'bp_core_clear_cache' );
    add_action( 'groups_accept_invite', 'bp_core_clear_cache' );
    add_action( 'groups_reject_invite', 'bp_core_clear_cache' );
    add_action( 'groups_invite_user', 'bp_core_clear_cache' );
    add_action( 'groups_uninvite_user', 'bp_core_clear_cache' );
    add_action( 'groups_details_updated', 'bp_core_clear_cache' );
    add_action( 'groups_settings_updated', 'bp_core_clear_cache' );
    add_action( 'groups_unban_member', 'bp_core_clear_cache' );
    add_action( 'groups_ban_member', 'bp_core_clear_cache' );
    add_action( 'groups_demote_member', 'bp_core_clear_cache' );
    add_action( 'groups_premote_member', 'bp_core_clear_cache' );
    add_action( 'groups_membership_rejected', 'bp_core_clear_cache' );
    add_action( 'groups_membership_accepted', 'bp_core_clear_cache' );
    add_action( 'groups_membership_requested', 'bp_core_clear_cache' );
    add_action( 'groups_create_group_step_complete', 'bp_core_clear_cache' );
    add_action( 'groups_created_group', 'bp_core_clear_cache' );
    add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' );
    
    add_action( 'messages_delete_thread', 'bp_core_clear_cache' );
    add_action( 'messages_send_notice', 'bp_core_clear_cache' );
    add_action( 'messages_message_sent', 'bp_core_clear_cache' );
    
    // Don't cache message inbox/sentbox/compose as it's too problematic
    add_action( 'messages_screen_compose', 'bp_core_clear_cache' );
    add_action( 'messages_screen_sentbox', 'bp_core_clear_cache' );
    add_action( 'messages_screen_inbox', 'bp_core_clear_cache' );

    Y prefer, rather than clearing cache, do not store community pages into my cache.

    And I have modified bp_core_clear_cache and now do nothing.

    /**
     * bp_core_clear_cache()
     * REQUIRES WP-SUPER-CACHE
     *
     * When wp-super-cache is installed this function will clear cached pages
     * so that success/error messages are not cached, or time sensitive content.
     *
     * @package BuddyPress Core
     */
    function bp_core_clear_cache() {
    
            return true;
    
    	global $cache_path, $cache_filename;
    
    	if ( function_exists( 'prune_super_cache' ) ) {
    		do_action( 'bp_core_clear_cache' );
    
    		return prune_super_cache( $cache_path, true );
    	}
    }

    Hi javiarques,

    I tried removing action from wp_login, it does the job but from only one ‘login’ form. As you mentioned this cache prune is called many times.

    Could you tell me the modification you did to the bp_core_clear_cache so that it does nothing ?

    Any way I am not going to cache the community pages, but just the blog posts.

    Thread Starter javiarques

    (@javiarques)

    You just have to modify the bp_core_clear_cache function so that the function does nothing, just return true.
    It’s not the best solution because you have to modify a plugin file wich can be updated in the future, but I dont know a better way because there are no actions or filters to hook.

    bp-core.php line 1883

    function bp_core_clear_cache() {
    
    return true;
    }

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WP Super Cache] Clear cache when user login??’ is closed to new replies.