Changeset 7637 for branches/2.5/wp-includes/post.php
- Timestamp:
- 04/09/2008 08:09:08 PM (18 years ago)
- File:
-
- 1 edited
-
branches/2.5/wp-includes/post.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.5/wp-includes/post.php
r7593 r7637 829 829 $user = wp_get_current_user(); 830 830 831 $cache_key = $type; 832 if ( !empty($perm) ) 833 $cache_key .= '_' . $perm; 834 831 835 $query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s"; 832 836 if ( 'readable' == $perm && is_user_logged_in() ) { 833 if ( !current_user_can("read_private_{$type}s") ) 837 if ( !current_user_can("read_private_{$type}s") ) { 838 $cache_key .= '_' . $user->ID; 834 839 $query .= " AND (post_status != 'private' OR ( post_author = '$user->ID' AND post_status = 'private' ))"; 840 } 835 841 } 836 842 $query .= ' GROUP BY post_status'; 843 844 $count = wp_cache_get($cache_key, 'counts'); 845 if ( false !== $count ) 846 return $count; 847 837 848 $count = $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A ); 838 849 … … 842 853 } 843 854 844 return (object) $stats; 845 } 855 $stats = (object) $stats; 856 wp_cache_set($cache_key, $stats, 'counts'); 857 858 return $stats; 859 } 860 846 861 847 862 /**
Note: See TracChangeset
for help on using the changeset viewer.