diff options
| author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
|---|---|---|
| committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
| commit | 87bb8cd69cc593fe6bed330fb1791eac9df87167 (patch) | |
| tree | 6b2ad252df89d2a1863198fd44b321b59e42ef54 /wp-admin/includes/post.php | |
| parent | 0cbda3349a2571904ea063fdd73e018299919589 (diff) | |
| download | wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.gz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.xz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.zip | |
Merge with WordPress, rev 6285 and untested
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/includes/post.php')
| -rw-r--r-- | wp-admin/includes/post.php | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index e27482c..b88e3b0 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -348,6 +348,8 @@ function add_meta( $post_ID ) { if ( in_array($metakey, $protected) ) return false; + wp_cache_delete($post_ID, 'post_meta'); + $result = $wpdb->query( " INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value ) @@ -362,6 +364,9 @@ function delete_meta( $mid ) { global $wpdb; $mid = (int) $mid; + $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'"); + wp_cache_delete($post_id, 'post_meta'); + return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" ); } @@ -408,6 +413,9 @@ function update_meta( $mid, $mkey, $mvalue ) { if ( in_array($mkey, $protected) ) return false; + $post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'"); + wp_cache_delete($post_id, 'post_meta'); + $mvalue = maybe_serialize( stripslashes( $mvalue )); $mvalue = $wpdb->escape( $mvalue ); $mid = (int) $mid; @@ -468,4 +476,41 @@ function _relocate_children( $old_ID, $new_ID ) { return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" ); } -?>
\ No newline at end of file +function wp_edit_posts_query( $q = '_GET' ) { + global $wpdb; + $$q['m'] = (int) $$q['m']; + $$q['cat'] = (int) $$q['cat']; + $post_stati = array( // array( adj, noun ) + 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), + 'future' => array(__('Scheduled'), __('Scheduled posts')), + 'pending' => array(__('Pending Review'), __('Pending posts')), + 'private' => array(__('Private'), __('Private posts')), + 'publish' => array(__('Published'), __('Published posts')) + ); + + $avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); + + $post_status_q = ''; + $post_status_label = _c('Posts|manage posts header'); + if ( isset($$q['post_status']) && in_array( $$q['post_status'], array_keys($post_stati) ) ) { + $post_status_label = $post_stati[$$q['post_status']][1]; + $post_status_q = '&post_status=' . $$q['post_status']; + } + + if ( 'pending' === $$q['post_status'] ) { + $order = 'ASC'; + $orderby = 'modified'; + } elseif ( 'draft' === $$q['post_status'] ) { + $order = 'DESC'; + $orderby = 'modified'; + } else { + $order = 'DESC'; + $orderby = 'date'; + } + + wp("what_to_show=posts$post_status_q&posts_per_page=20&order=$order&orderby=$orderby"); + + return array($post_stati, $avail_post_stati); +} + +?> |
