Ticket #22917: 22917-2.diff
File 22917-2.diff, 2.6 KB (added by , 12 years ago) |
---|
-
wp-includes/ms-functions.php
923 923 delete_user_option( $user_id, 'user_level' ); 924 924 925 925 do_action( 'wpmu_new_user', $user_id ); 926 if ( apply_filters( 'enable_live_network_user_counts', false ) ) 927 wp_update_network_user_counts(); //user added, update network counts 926 928 927 929 return $user_id; 928 930 } … … 1151 1153 populate_options(); 1152 1154 populate_roles(); 1153 1155 $wp_roles->_init(); 1156 if ( apply_filters ( 'enable_live_network_blog_counts', false ) ) 1157 wp_update_network_blog_counts(); //new blog added, update network counts 1154 1158 1155 1159 $url = untrailingslashit( $url ); 1156 1160 … … 1925 1929 * @since 3.1.0 1926 1930 */ 1927 1931 function wp_update_network_counts() { 1932 wp_update_network_user_counts(); 1933 wp_update_network_blog_counts(); 1934 } 1935 1936 /** 1937 * Update the network-wide counts for users 1938 * 1939 * @since 3.6 1940 * 1941 */ 1942 function wp_update_network_user_counts() { 1928 1943 global $wpdb; 1929 1944 1930 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) );1931 update_site_option( 'blog_count', $count );1932 1933 1945 $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" ); 1934 1946 update_site_option( 'user_count', $count ); 1935 1947 } 1936 1948 1937 1949 /** 1950 * Update the network-wide counts for blogs 1951 * 1952 * @since 3.6 1953 * 1954 */ 1955 function wp_update_network_blog_counts() { 1956 global $wpdb; 1957 1958 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) ); 1959 update_site_option( 'blog_count', $count ); 1960 } 1961 1962 /** 1938 1963 * Returns the space used by the current blog. 1939 1964 * 1940 1965 * @since 3.5.0 -
wp-admin/includes/ms.php
122 122 } 123 123 124 124 clean_blog_cache( $blog ); 125 } 125 if ( apply_filters( 'enable_live_network_blog_counts', false ) ) 126 wp_update_network_blog_counts(); //blog deleted, update network counts 127 } 126 128 127 129 if ( $switch ) 128 130 restore_current_blog(); … … 171 173 $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); 172 174 173 175 clean_user_cache( $user ); 176 if ( apply_filters( 'enable_live_network_user_counts', false ) ) 177 wp_update_network_user_counts(); //user deleted, update network counts 174 178 175 179 // allow for commit transaction 176 180 do_action( 'deleted_user', $id );