Changeset 15566
- Timestamp:
- 09/05/2010 02:35:55 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/default-list-tables.php
r15542 r15566 1795 1795 $style = ''; 1796 1796 foreach ( $this->items as $userid => $user_object ) { 1797 $roles = $user_object->roles; 1798 $role = array_shift( $roles ); 1797 $role = reset( $user_object->roles ); 1799 1798 1800 1799 if ( is_multisite() && empty( $role ) ) … … 2792 2791 $blogusers_warning = __( 'Only showing first 5 users.' ) . ' <a href="' . esc_url( get_admin_url( $blog['blog_id'], 'users.php' ) ) . '">' . __( 'More' ) . '</a>'; 2793 2792 } 2794 foreach ( $blogusers as $ key => $val) {2795 echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $ val->user_id ) ) . '">' . esc_html( $val->user_login ) . '</a> ';2793 foreach ( $blogusers as $user_object ) { 2794 echo '<a href="' . esc_url( admin_url( 'user-edit.php?user_id=' . $user_object->ID ) ) . '">' . esc_html( $user_object->user_login ) . '</a> '; 2796 2795 if ( 'list' != $mode ) 2797 echo '( ' . $ val->user_email . ' )';2796 echo '( ' . $user_object->user_email . ' )'; 2798 2797 echo '<br />'; 2799 2798 } -
trunk/wp-admin/network/sites.php
r15528 r15566 259 259 // Site users 260 260 $blogusers = get_users_of_blog( $id ); 261 261 262 if ( is_array( $blogusers ) ) { 262 263 echo '<div id="blogedit_blogusers" class="postbox"><h3 class="hndle"><span>' . __( 'Site Users' ) . '</span></h3><div class="inside">'; 263 264 echo '<table class="form-table">'; 264 265 echo "<tr><th>" . __( 'User' ) . "</th><th>" . __( 'Role' ) . "</th><th>" . __( 'Password' ) . "</th><th>" . __( 'Remove' ) . "</th></tr>"; 265 reset( $blogusers ); 266 foreach ( (array) $blogusers as $key => $val ) { 267 if ( isset( $val->meta_value ) && ! $val->meta_value ) 268 continue; 269 $t = @unserialize( $val->meta_value ); 270 if ( is_array( $t ) ) { 271 reset( $t ); 272 $existing_role = key( $t ); 273 } 274 echo '<tr><td><a href="user-edit.php?user_id=' . $val->user_id . '">' . $val->user_login . '</a></td>'; 275 if ( $val->user_id != $current_user->data->ID ) { 266 foreach ( $blogusers as $user_id => $user_object ) { 267 $existing_role = reset( $user_object->roles ); 268 269 echo '<tr><td><a href="user-edit.php?user_id=' . $user_id . '">' . $user_object->user_login . '</a></td>'; 270 if ( $user_id != $current_user->data->ID ) { 276 271 ?> 277 272 <td> 278 <select name="role[<?php echo $ val->user_id ?>]" id="new_role_1"><?php273 <select name="role[<?php echo $user_id ?>]" id="new_role_1"><?php 279 274 foreach ( $editblog_roles as $role => $role_assoc ){ 280 275 $name = translate_user_role( $role_assoc['name'] ); … … 285 280 </td> 286 281 <td> 287 <input type="text" name="user_password[<?php echo esc_attr( $ val->user_id ) ?>]" />282 <input type="text" name="user_password[<?php echo esc_attr( $user_id ) ?>]" /> 288 283 </td> 289 284 <?php 290 echo '<td><input title="' . __( 'Click to remove user' ) . '" type="checkbox" name="blogusers[' . esc_attr( $ val->user_id ) . ']" /></td>';285 echo '<td><input title="' . __( 'Click to remove user' ) . '" type="checkbox" name="blogusers[' . esc_attr( $user_id ) . ']" /></td>'; 291 286 } else { 292 287 echo "<td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __ ( 'N/A' ) . "</strong></td><td><strong>" . __( 'N/A' ) . "</strong></td>"; -
trunk/wp-includes/capabilities.php
r15561 r15566 472 472 * @param int|string $id User's ID or username 473 473 * @param int $name Optional. User's username 474 * @param int $blog_id Optional Blog ID, defaults to current blog. 474 475 * @return WP_User 475 476 */ 476 function WP_User( $id, $name = '' ) {477 function WP_User( $id, $name = '', $blog_id = '' ) { 477 478 478 479 if ( empty( $id ) && empty( $name ) ) … … 497 498 498 499 $this->id = $this->ID; 499 $this-> _init_caps();500 $this->for_blog( $blog_id ); 500 501 } 501 502 -
trunk/wp-includes/functions.php
r15565 r15566 4226 4226 * 4227 4227 * @param array $queries An array of queries 4228 * @param string $meta_id_column The column that holds the object id 4229 * @param string $table Which meta table to look in 4228 4230 * @return string 4229 4231 */ -
trunk/wp-includes/user.php
r15565 r15566 375 375 if ( !empty( $query ) ) { 376 376 $this->query_vars = wp_parse_args( $query, array( 377 'search' => '', 'role' => '', 377 'role' => '', 'blog_id' => $GLOBALS['blog_id'], 378 'meta_key' => '', 'meta_value' => '', 'meta_compare' => '', 379 'include' => array(), 'exclude' => array(), 380 'search' => '', 381 'orderby' => 'login', 'order' => 'ASC', 378 382 'offset' => '', 'number' => '', 'count_total' => true, 379 'orderby' => 'login', 'order' => 'ASC',380 'meta_key' => '', 'meta_value' => '',381 'include' => array(), 'exclude' => array(),382 383 'fields' => 'all', 383 384 ) ); … … 445 446 446 447 $role = trim( $qv['role'] ); 448 $blog_id = absint( $qv['blog_id'] ); 447 449 448 450 $meta_queries = array(); 449 451 450 $cap_meta_query = array(); 451 $cap_meta_key = $wpdb->prefix . 'capabilities'; 452 453 if ( $role || is_multisite() ) 454 $cap_meta_query['meta_key'] = $cap_meta_key; 455 456 if ( $role ) { 457 $cap_meta_query['meta_value'] = $role; 458 $cap_meta_query['meta_compare'] = 'like'; 459 } 460 461 $meta_queries[] = $cap_meta_query; 452 if ( $blog_id ) { 453 $cap_meta_query = array(); 454 $cap_meta_query['meta_key'] = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities'; 455 456 if ( $role ) { 457 $cap_meta_query['meta_value'] = $role; 458 $cap_meta_query['meta_compare'] = 'like'; 459 } 460 461 $meta_queries[] = $cap_meta_query; 462 } 462 463 463 464 $meta_queries[] = array( … … 507 508 $r = array(); 508 509 foreach ( $this->results as $userid ) 509 $r[ $userid ] = new WP_User( $userid );510 $r[ $userid ] = new WP_User( $userid, '', $this->query_vars['blog_id'] ); 510 511 511 512 $this->results = $r; … … 565 566 * 566 567 * @since 2.2.0 567 * @uses $wpdb WordPress database objectfor queries568 * @uses get_users() for queries 568 569 * @uses $blog_id The Blog id of the blog for those that use more than one blog 569 570 * … … 573 574 function get_users_of_blog( $id = '' ) { 574 575 global $wpdb, $blog_id; 576 575 577 if ( empty($id) ) 576 578 $id = (int) $blog_id; 577 $blog_prefix = $wpdb->get_blog_prefix($id); 578 $users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" ); 579 return $users; 579 580 return get_users( array( 'blog_id' => $id ) ); 580 581 } 581 582
Note: See TracChangeset
for help on using the changeset viewer.