|
103 | 103 | */ |
104 | 104 | if ( apply_filters( 'propagate_network_user_spam_to_blogs', false, $user_id ) ) { |
105 | 105 | foreach ( get_blogs_of_user( $user_id, true ) as $details ) { |
106 | | - // Assuming the main site is not a spam. |
107 | | - if ( ! is_main_site( $details->userblog_id ) ) { |
108 | | - update_blog_status( $details->userblog_id, 'spam', '1' ); |
| 106 | + // Do not mark the main site as spam, and only affect the current network. |
| 107 | + if ( is_main_site( $details->userblog_id ) || get_current_network_id() !== $details->site_id ) { |
| 108 | + continue; |
109 | 109 | } |
| 110 | + // Only mark sites where the user is the registered site admin. |
| 111 | + if ( get_blog_option( $details->userblog_id, 'admin_email' ) !== $user->user_email ) { |
| 112 | + continue; |
| 113 | + } |
| 114 | + update_blog_status( $details->userblog_id, 'spam', '1' ); |
110 | 115 | } |
111 | 116 | } |
112 | 117 |
|
|
131 | 136 | } |
132 | 137 |
|
133 | 138 | $userfunction = 'all_notspam'; |
134 | | - $blogs = get_blogs_of_user( $user_id, true ); |
135 | 139 |
|
136 | 140 | /** This filter is documented in wp-admin/network/users.php */ |
137 | 141 | if ( apply_filters( 'propagate_network_user_spam_to_blogs', false, $user_id ) ) { |
138 | 142 | foreach ( get_blogs_of_user( $user_id, true ) as $details ) { |
139 | | - if ( ! is_main_site( $details->userblog_id ) && get_current_network_id() === $details->site_id ) { |
140 | | - // Assuming main site is never a spam and part of the current network. |
141 | | - update_blog_status( $details->userblog_id, 'spam', '0' ); |
| 143 | + // Do not unmark the main site as spam, and only affect the current network. |
| 144 | + if ( is_main_site( $details->userblog_id ) || get_current_network_id() !== $details->site_id ) { |
| 145 | + continue; |
| 146 | + } |
| 147 | + // Only unmark sites where the user is the registered site admin. |
| 148 | + if ( get_blog_option( $details->userblog_id, 'admin_email' ) !== $user->user_email ) { |
| 149 | + continue; |
142 | 150 | } |
| 151 | + update_blog_status( $details->userblog_id, 'spam', '0' ); |
143 | 152 | } |
144 | 153 | } |
145 | 154 |
|
|
0 commit comments