Ticket #22917: 22917.3.diff
File 22917.3.diff, 2.6 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ms.php
122 122 } 123 123 124 124 clean_blog_cache( $blog ); 125 if ( apply_filters( 'enable_live_network_blog_counts', false ) ) 126 wp_update_network_blog_counts(); // blog deleted, update network counts 125 127 } 126 128 127 129 if ( $switch ) … … 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 ); -
wp-includes/ms-functions.php
914 914 delete_user_option( $user_id, 'user_level' ); 915 915 916 916 do_action( 'wpmu_new_user', $user_id ); 917 if ( apply_filters( 'enable_live_network_user_counts', false ) ) 918 wp_update_network_user_counts(); // user added, update network counts 917 919 918 920 return $user_id; 919 921 } … … 1142 1144 populate_options(); 1143 1145 populate_roles(); 1144 1146 $wp_roles->_init(); 1147 if ( apply_filters( 'enable_live_network_blog_counts', false ) ) 1148 wp_update_network_blog_counts(); // new blog added, update network counts 1145 1149 1146 1150 $url = untrailingslashit( $url ); 1147 1151 … … 1887 1891 * @since 3.1.0 1888 1892 */ 1889 1893 function wp_update_network_counts() { 1894 wp_update_network_user_counts(); 1895 wp_update_network_blog_counts(); 1896 } 1897 1898 /** 1899 * Update the network-wide counts for users. 1900 * 1901 * @since 3.6.0 1902 */ 1903 function wp_update_network_user_counts() { 1890 1904 global $wpdb; 1891 1905 1892 $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) );1893 update_site_option( 'blog_count', $count );1894 1895 1906 $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" ); 1896 1907 update_site_option( 'user_count', $count ); 1897 1908 } 1898 1909 1899 1910 /** 1911 * Update the network-wide counts for blogs. 1912 * 1913 * @since 3.6.0 1914 */ 1915 function wp_update_network_blog_counts() { 1916 global $wpdb; 1917 1918 $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 ) ); 1919 update_site_option( 'blog_count', $count ); 1920 } 1921 1922 /** 1900 1923 * Returns the space used by the current blog. 1901 1924 * 1902 1925 * @since 3.5.0