Changeset 5587
- Timestamp:
- 05/29/2007 04:28:10 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r5543 r5587 117 117 118 118 <?php 119 $authors = get_editable_ authors( $current_user->id ); // TODO: ROLE SYSTEM119 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM 120 120 if ( $authors && count( $authors ) > 1 ) : 121 121 ?> … … 123 123 <h3 class="dbx-handle"><?php _e('Post Author'); ?></h3> 124 124 <div class="dbx-content"> 125 <select name="post_author_override" id="post_author_override"> 126 <?php 127 foreach ($authors as $o) : 128 $o = get_userdata( $o->ID ); 129 if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"'; 130 else $selected = ''; 131 echo "<option value='" . (int) $o->ID . "' $selected>" . wp_specialchars( $o->display_name ) . "</option>"; 132 endforeach; 133 ?> 134 </select> 125 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?> 135 126 </div> 136 127 </fieldset> -
trunk/wp-admin/edit-pages.php
r5583 r5587 14 14 15 15 $post_status_label = _c('Pages|manage pages header'); 16 $post_listing_pageable = true;17 16 $post_status_q = ''; 18 17 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { 19 18 $post_status_label = $post_stati[$_GET['post_status']][1]; 20 $post_listing_pageable = false;21 19 $post_status_q = '&post_status=' . $_GET['post_status']; 22 if ( 'publish' == $_GET['post_status'] );23 $post_listing_pageable = true;24 20 } 25 21 … … 31 27 // Use $_GET instead of is_ since they can override each other 32 28 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( stripslashes( $_GET['s'] ) ) ) : ''; 33 printf( _c( '%1$s%2$s|manage pages header' ), $post_status_label, $h2_search ); 29 $h2_author = ''; 30 if ( isset($_GET['author']) && $_GET['author'] ) { 31 $author_user = get_userdata( (int) $_GET['author'] ); 32 $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name )); 33 } 34 printf( _c( '%1$s%2$s%3$s|manage pages header' ), $post_status_label, $h2_author, $h2_search ); 34 35 ?></h2> 35 36 … … 50 51 </select> 51 52 </fieldset> 53 54 <?php $editable_ids = get_editable_user_ids( $user_ID ); if ( $editable_ids && count( $editable_ids ) > 1 ) : ?> 55 56 <fieldset><legend><?php _e('Author…'); ?></legend> 57 <?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?> 58 </fieldset> 59 60 <?php endif; ?> 52 61 53 62 <input type="submit" id="post-query-submit" value="<?php _e('Filter »'); ?>" class="button" /> -
trunk/wp-admin/edit.php
r5583 r5587 17 17 18 18 $post_status_q = ''; 19 $author_q = '';20 19 $post_status_label = _c('Posts|manage posts header'); 21 $post_listing_pageable = true;22 20 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { 23 21 $post_status_label = $post_stati[$_GET['post_status']][1]; 24 $post_listing_pageable = false;25 22 $post_status_q = '&post_status=' . $_GET['post_status']; 26 if ( in_array( $_GET['post_status'], array('draft', 'private') ) )27 $author_q = "&author=$user_ID";28 elseif ( 'publish' == $_GET['post_status'] );29 $post_listing_pageable = true;30 23 } 31 24 ?> … … 35 28 <?php 36 29 37 wp("what_to_show=posts$ author_q$post_status_q&posts_per_page=15&posts_per_archive_page=-1");30 wp("what_to_show=posts$post_status_q&posts_per_page=15"); 38 31 39 32 do_action('restrict_manage_posts'); … … 66 59 $h2_noun = $post_status_label; 67 60 // Use $_GET instead of is_ since they can override each other 61 $h2_author = ''; 62 if ( isset($_GET['author']) && $_GET['author'] ) { 63 $author_user = get_userdata( get_query_var( 'author' ) ); 64 $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name )); 65 } 68 66 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : ''; 69 67 $h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : ''; 70 68 $h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : ''; 71 printf( _c( '%1$s%2$s%3$s%4$s |manage posts header' ), $h2_noun, $h2_search, $h2_cat, $h2_month );69 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 ); 72 70 } 73 71 ?></h2> … … 87 85 </fieldset> 88 86 87 <?php 88 $editable_ids = get_editable_user_ids( $user_ID ); 89 if ( $editable_ids && count( $editable_ids ) > 1 ) : 90 ?> 91 <fieldset><legend><?php _e('Author…'); ?></legend> 92 <?php wp_dropdown_users( array('include' => $editable_ids, 'show_option_all' => __('Any'), 'name' => 'author', 'selected' => isset($_GET['author']) ? $_GET['author'] : 0) ); ?> 93 </fieldset> 94 89 95 <?php 90 96 endif; 91 97 92 98 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC"; … … 130 136 <br style="clear:both;" /> 131 137 132 <?php 133 if ( $post_status_q && ( false !== strpos($post_status_q, 'draft') || false !== strpos($post_status_q, 'private') ) ) { 134 echo '<h3>' . __('Your Posts') . "</h3>\n"; 135 include( 'edit-post-rows.php' ); 136 137 $editable_ids = get_editable_user_ids( $user_ID ); 138 139 if ( $editable_ids && count($editable_ids) > 1 ) { 140 $_editable_ids = join(',', array_diff($editable_ids, array($user_ID))); 141 142 $post_status_q = "&post_status=" . $_GET['post_status']; 143 144 unset($GLOBALS['day']); // setup_postdata does this 145 wp("what_to_show=posts&author=$_editable_ids$post_status_q&posts_per_page=-1&posts_per_archive_page=-1"); 146 147 if ( have_posts() ) { 148 echo '<h3>' . __("Others' Posts") . "</h3>\n"; 149 include( 'edit-post-rows.php' ); 150 } 151 } 152 153 } else { 154 include( 'edit-post-rows.php' ); 155 } 156 ?> 138 <?php include( 'edit-post-rows.php' ); ?> 157 139 158 140 <div id="ajax-response"></div> -
trunk/wp-admin/includes/upload.php
r5542 r5587 285 285 286 286 function wp_upload_tab_browse() { 287 global $ wpdb, $action, $paged;287 global $action, $paged; 288 288 $old_vars = compact( 'paged' ); 289 289 … … 302 302 if ( 'browse' == $tab && $post_id ) 303 303 add_filter( 'posts_where', 'wp_upload_posts_where' ); 304 $attachments = query_posts("what_to_show=posts&posts_per_page=10&paged=$paged"); 305 $count_query = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'"; 306 if ( $post_id ) 307 $count_query .= " AND post_parent = '$post_id'"; 308 $total = $wpdb->get_var($count_query); 304 $attachments = query_posts("what_to_show=posts&post_status=any&posts_per_page=10&paged=$paged"); 309 305 310 306 echo "<ul id='upload-files'>\n"; -
trunk/wp-includes/user.php
r5194 r5587 180 180 } 181 181 182 function wp_dropdown_users( $args = '' ) { 183 global $wpdb; 184 $defaults = array( 185 'show_option_all' => '', 'show_option_none' => '', 186 'orderby' => 'display_name', 'order' => 'ASC', 187 'include' => '', 'exclude' => '', 188 'show' => 'display_name', 'echo' => 1, 189 'selected' => 0, 'name' => 'user', 'class' => '' 190 ); 191 192 $defaults['selected'] = is_author() ? get_query_var( 'author' ) : 0; 193 194 $r = wp_parse_args( $args, $defaults ); 195 extract( $r ); 196 197 $query = "SELECT * FROM $wpdb->users"; 198 199 $query_where = array(); 200 201 if ( is_array($include) ) 202 $include = join(',', $include); 203 $include = preg_replace('/[^0-9,]/', '', $include); // (int) 204 if ( $include ) 205 $query_where[] = "ID IN ($include)"; 206 207 if ( is_array($exclude) ) 208 $exclude = join(',', $exclude); 209 $exclude = preg_replace('/[^0-9,]/', '', $exclude); // (int) 210 if ( $exclude ) 211 $query_where[] = "ID NOT IN ($exclude)"; 212 213 if ( $query_where ) 214 $query .= " WHERE " . join(' AND', $query_where); 215 216 $query .= " ORDER BY $orderby $order"; 217 218 $users = $wpdb->get_results( $query ); 219 220 $output = ''; 221 if ( !empty($users) ) { 222 $output = "<select name='$name' id='$name' class='$class'>\n"; 223 224 if ( $show_option_all ) 225 $output .= "\t<option value='0'>$show_option_all</option>\n"; 226 227 if ( $show_option_none ) 228 $output .= "\t<option value='-1'>$show_option_none</option>\n"; 229 230 foreach ( $users as $user ) { 231 $user->ID = (int) $user->ID; 232 $_selected = $user->ID == $selected ? " selected='selected'" : ''; 233 $output .= "\t<option value='$user->ID'$_selected>" . wp_specialchars($user->$show) . "</option>\n"; 234 } 235 236 $output .= "</select>"; 237 } 238 239 $output = apply_filters('wp_dropdown_users', $output); 240 241 if ( $echo ) 242 echo $output; 243 244 return $output; 245 } 246 182 247 ?>
Note: See TracChangeset
for help on using the changeset viewer.