bp_active_member_count transient remains unchanged
-
Hi !
At http://fablab-lannion.org, we noticed the member count remained unchanged, and showed a false (low) value. I started troubleshooting, and it appears the bp_core_get_active_member_count() function sets a transient ‘bp_active_member_count’ option but with no expiration parameter, which means it is there forever.
I had to make a small function to make sure the member count could change :
function reset_transient_bp_active_member_count(){
//delete_transient( 'bp_active_member_count');
global $wpdb;
global $firephp;
if ( $names = $wpdb->get_results( "SELECT option_name FROM {$wpdb->options} WHERE option_name = '_transient_timeout_bp_active_member_count'" ) ) {
// $firephp->log('do nothing, there's already a timeout',strrchr(__FILE__,'/') . ':' . __FUNCTION__ . ':' . __LINE__);
}
else {
// $firephp->log('set the transient with the same value, but with an expiration',strrchr(__FILE__,'/') . ':' . __FUNCTION__ . ':' . __LINE__);
set_transient('bp_active_member_count', get_transient('bp_active_member_count'),HOUR_IN_SECONDS);
}
}
add_action('wp_head','reset_transient_bp_active_member_count');
- The topic ‘bp_active_member_count transient remains unchanged’ is closed to new replies.