From 442ef7253a3bbaa8e01ef73585d95a6333fc2b2b Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 29 May 2007 04:28:10 +0000 Subject: [PATCH] Post and page management filter additions from mdawaffe. see #3945 git-svn-id: https://develop.svn.wordpress.org/trunk@5587 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-form-advanced.php | 13 +------ wp-admin/edit-pages.php | 19 +++++++--- wp-admin/edit.php | 52 +++++++++----------------- wp-admin/includes/upload.php | 10 ++--- wp-includes/user.php | 65 +++++++++++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 58 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index f3edaa530e..6d19ce90ed 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -116,22 +116,13 @@ addLoadEvent(focusit); id ); // TODO: ROLE SYSTEM +$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM if ( $authors && count( $authors ) > 1 ) : ?>

- + $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 61e0aac4e5..aa3c6e99f2 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -13,14 +13,10 @@ $post_stati = array( // array( adj, noun ) $post_status_label = _c('Pages|manage pages header'); -$post_listing_pageable = true; $post_status_q = ''; if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { $post_status_label = $post_stati[$_GET['post_status']][1]; - $post_listing_pageable = false; $post_status_q = '&post_status=' . $_GET['post_status']; - if ( 'publish' == $_GET['post_status'] ); - $post_listing_pageable = true; } ?> @@ -30,7 +26,12 @@ if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($

display_name )); +} +printf( _c( '%1$s%2$s%3$s|manage pages header' ), $post_status_label, $h2_author, $h2_search ); ?>

@@ -50,6 +51,14 @@ printf( _c( '%1$s%2$s|manage pages header' ), $post_status_label, $h2_search ); + 1 ) : ?> + +
+ $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?> +
+ + + diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 7328fbd303..ecae267ee8 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -16,17 +16,10 @@ $post_stati = array( // array( adj, noun ) ); $post_status_q = ''; -$author_q = ''; $post_status_label = _c('Posts|manage posts header'); -$post_listing_pageable = true; if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { $post_status_label = $post_stati[$_GET['post_status']][1]; - $post_listing_pageable = false; $post_status_q = '&post_status=' . $_GET['post_status']; - if ( in_array( $_GET['post_status'], array('draft', 'private') ) ) - $author_q = "&author=$user_ID"; - elseif ( 'publish' == $_GET['post_status'] ); - $post_listing_pageable = true; } ?> @@ -34,7 +27,7 @@ if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($ display_name )); + } $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : ''; $h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : ''; $h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : ''; - printf( _c( '%1$s%2$s%3$s%4$s|manage posts header' ), $h2_noun, $h2_search, $h2_cat, $h2_month ); + printf( _c( '%1$s%2$s%3$s%4$s%5$s|manage posts header' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_month ); } ?> @@ -86,8 +84,16 @@ if ( is_single() ) { - 1 ) : +?> +
+ $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?> +
+posts WHERE post_type = 'post' ORDER BY post_date DESC"; @@ -129,31 +135,7 @@ if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?
-' . __('Your Posts') . "\n"; - include( 'edit-post-rows.php' ); - - $editable_ids = get_editable_user_ids( $user_ID ); - - if ( $editable_ids && count($editable_ids) > 1 ) { - $_editable_ids = join(',', array_diff($editable_ids, array($user_ID))); - - $post_status_q = "&post_status=" . $_GET['post_status']; - - unset($GLOBALS['day']); // setup_postdata does this - wp("what_to_show=posts&author=$_editable_ids$post_status_q&posts_per_page=-1&posts_per_archive_page=-1"); - - if ( have_posts() ) { - echo '

' . __("Others' Posts") . "

\n"; - include( 'edit-post-rows.php' ); - } - } - -} else { - include( 'edit-post-rows.php' ); -} -?> +
diff --git a/wp-admin/includes/upload.php b/wp-admin/includes/upload.php index 92c1ceaf83..341a60ca2c 100644 --- a/wp-admin/includes/upload.php +++ b/wp-admin/includes/upload.php @@ -284,7 +284,7 @@ function wp_upload_posts_where( $where ) { } function wp_upload_tab_browse() { - global $wpdb, $action, $paged; + global $action, $paged; $old_vars = compact( 'paged' ); switch ( $action ) : @@ -301,11 +301,7 @@ function wp_upload_tab_browse() { add_action( 'pre_get_posts', 'wp_upload_grab_attachments' ); if ( 'browse' == $tab && $post_id ) add_filter( 'posts_where', 'wp_upload_posts_where' ); - $attachments = query_posts("what_to_show=posts&posts_per_page=10&paged=$paged"); - $count_query = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'"; - if ( $post_id ) - $count_query .= " AND post_parent = '$post_id'"; - $total = $wpdb->get_var($count_query); + $attachments = query_posts("what_to_show=posts&post_status=any&posts_per_page=10&paged=$paged"); echo "