Changeset 15539
- Timestamp:
- 08/27/2010 12:18:57 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r15183 r15539 150 150 151 151 if ( post_type_supports($post_type, 'author') ) { 152 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM 153 if ( $post->post_author && !in_array($post->post_author, $authors) ) 154 $authors[] = $post->post_author; 155 if ( ( $authors && count( $authors ) > 1 ) || is_super_admin() ) 152 $_editable_user_ids = get_editable_user_ids( $current_user->id, true, $post_type ); // TODO: ROLE SYSTEM 153 if ( $post->post_author && !in_array($post->post_author, $_editable_user_ids) ) 154 $_editable_user_ids[] = $post->post_author; 155 156 if ( !empty($_editable_user_ids) || is_super_admin() ) 156 157 add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core'); 157 158 } -
trunk/wp-admin/includes/meta-boxes.php
r15528 r15539 506 506 */ 507 507 function post_author_meta_box($post) { 508 global $user_ID; 509 $authors = get_editable_user_ids( get_current_user_id(), true, $post->post_type ); // TODO: ROLE SYSTEM 510 if ( $post->post_author && !in_array($post->post_author, $authors) ) 511 $authors[] = $post->post_author; 508 global $user_ID, $_editable_user_ids; 509 512 510 ?> 513 511 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?> -
trunk/wp-admin/includes/user.php
r15491 r15539 241 241 * 242 242 * @param int $user_id User ID. 243 * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros. 244 * @return unknown 245 */ 246 function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { 247 global $wpdb; 243 * @param bool $deprecated Not used. 244 * @return array 245 */ 246 function get_editable_user_ids( $user_id, $deprecated = true, $post_type = 'post' ) { 247 global $wpdb; 248 249 if ( !$deprecated ) 250 _deprecated_argument( __FUNCTION__, '3.1.0' ); 248 251 249 252 $user = new WP_User( $user_id ); … … 257 260 } 258 261 259 if ( !is_multisite() ) 260 $level_key = $wpdb->get_blog_prefix() . 'user_level'; 261 else 262 $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels 263 264 $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); 265 if ( $exclude_zeros ) 266 $query .= " AND meta_value != '0'"; 267 268 return $wpdb->get_col( $query ); 262 return get_users( array('fields' => 'ids') ); 269 263 } 270 264 -
trunk/wp-includes/user.php
r15491 r15539 435 435 436 436 $role = trim( $qv['role'] ); 437 438 if ( $role || is_multisite() ) { 439 $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; 440 $this->query_where .= $wpdb->prepare( " AND $wpdb->usermeta.meta_key = %s", $wpdb->prefix . 'capabilities' ); 441 } 442 437 443 if ( $role ) { 438 $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; 439 $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $role . '%'); 440 } elseif ( is_multisite() ) { 441 $level_key = $wpdb->prefix . 'capabilities'; // wpmu site admins don't have user_levels 442 $this->query_from .= ", $wpdb->usermeta"; 443 $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'"; 444 $this->query_where .= $wpdb->prepare( " AND $wpdb->usermeta.meta_value LIKE %s", '%' . like_escape( $role ) . '%' ); 444 445 } 445 446
Note: See TracChangeset
for help on using the changeset viewer.