Ticket #37538: 37538.diff
| File 37538.diff, 3.0 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/network/users.php
75 75 $userfunction = 'all_spam'; 76 76 $blogs = get_blogs_of_user( $user_id, true ); 77 77 foreach ( (array) $blogs as $details ) { 78 if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! 78 // main blog not a spam ! 79 if ( (int) $details->userblog_id === (int) $current_site->blog_id ) { 80 continue; 81 } 82 83 /** 84 * Do not punish an entire site if one of its subscriber 85 * has been marked as spam. 86 */ 87 if ( 'subscriber' !== $details->user_role ) { 79 88 update_blog_status( $details->userblog_id, 'spam', '1' ); 89 } 80 90 } 81 91 update_user_status( $user_id, 'spam', '1' ); 82 92 break; -
src/wp-includes/user.php
621 621 $blogs = array(); 622 622 623 623 if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) { 624 $blog = get_blog_details( 1 ); 624 $blog = get_blog_details( 1 ); 625 $user_roles = get_user_meta( $user_id, $wpdb->base_prefix . 'capabilities', true ); 626 $user_role = ''; 627 if ( is_array( $user_roles ) ) { 628 $user_role = key( $user_roles ); 629 } 625 630 if ( $blog && isset( $blog->domain ) && ( $all || ( ! $blog->archived && ! $blog->spam && ! $blog->deleted ) ) ) { 626 631 $blogs[ 1 ] = (object) array( 627 632 'userblog_id' => 1, … … 634 639 'mature' => $blog->mature, 635 640 'spam' => $blog->spam, 636 641 'deleted' => $blog->deleted, 642 'user_role' => $user_role, 637 643 ); 638 644 } 639 645 unset( $keys[ $wpdb->base_prefix . 'capabilities' ] ); 640 646 } 641 647 642 $keys = array_keys( $keys ); 643 644 foreach ( $keys as $key ) { 648 foreach ( $keys as $key => $value ) { 645 649 if ( 'capabilities' !== substr( $key, -12 ) ) 646 650 continue; 647 651 if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) ) … … 650 654 if ( ! is_numeric( $blog_id ) ) 651 655 continue; 652 656 657 // Reset the user role at each loop. 658 $user_role = ''; 659 660 // Unserialize meta value 661 if ( is_array( $value ) ) { 662 $value = array_map( 'maybe_unserialize', $value ); 663 } else { 664 $value = maybe_unserialize( $value ); 665 } 666 667 if ( is_array( $value ) ) { 668 // Only take the first meta_id. 669 $user_roles = reset( $value ); 670 671 // Only take the first role. 672 if ( is_array( $user_roles ) ) { 673 $user_role = key( $user_roles ); 674 } 675 } 676 653 677 $blog_id = (int) $blog_id; 654 678 $blog = get_blog_details( $blog_id ); 655 679 if ( $blog && isset( $blog->domain ) && ( $all || ( ! $blog->archived && ! $blog->spam && ! $blog->deleted ) ) ) { … … 664 688 'mature' => $blog->mature, 665 689 'spam' => $blog->spam, 666 690 'deleted' => $blog->deleted, 691 'user_role' => $user_role, 667 692 ); 668 693 } 669 694 }