Ticket #20774: 20774.noquicklinks.diff
File 20774.noquicklinks.diff, 4.3 KB (added by , 12 years ago) |
---|
-
wp-admin/network/users.php
88 88 89 89 if ( isset( $_GET['action'] ) ) { 90 90 do_action( 'wpmuadminedit' , '' ); 91 92 $mark_sites_for_spam_user = apply_filters( 'mark_sites_for_spam_user' , false , $val ); 91 93 92 94 switch ( $_GET['action'] ) { 95 93 96 case 'deleteuser': 94 97 if ( ! current_user_can( 'manage_network_users' ) ) 95 98 wp_die( __( 'You do not have permission to access this page.' ) ); 96 97 99 check_admin_referer( 'deleteuser' ); 98 100 99 101 $id = intval( $_GET['id'] ); … … 111 113 } 112 114 exit(); 113 115 break; 116 117 case 'spamuser': 118 119 if ( ! current_user_can( 'edit_users' ) ) 120 wp_die( __( 'You do not have permission to access this page.' ) ); 121 check_admin_referer( 'spamuser' ); 122 123 $id = intval( $_GET['id'] ); 124 $user = get_userdata( $id ); 125 if ( false === $user || is_super_admin( $user->ID ) ) 126 continue; 127 128 $blogs = get_blogs_of_user( $id, true ); 129 if ( $mark_sites_for_spam_user ) { 130 131 foreach ( (array) $blogs as $key => $details ) { 132 // do not mark main site 133 if ( $details->userblog_id == $current_site->blog_id ) 134 continue; 135 // only if admin email is same as user 136 if ( $user->data->user_email != get_blog_option ( $details->userblog_id , 'admin_email' ) ) 137 continue; 138 update_blog_status( $details->userblog_id, 'spam', '1' ); 139 } 140 } 141 update_user_status( $id, 'spam', '1' ); 142 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); 143 144 break; 145 146 case 'unspamuser' : 147 148 if ( ! current_user_can( 'edit_users' ) ) 149 wp_die( __( 'You do not have permission to access this page.' ) ); 150 check_admin_referer( 'unspamuser' ); 151 152 $id = intval( $_GET['id'] ); 153 $user = get_userdata( $id ); 154 if ( false === $user || is_super_admin( $user->ID ) ) 155 continue; 114 156 157 update_user_status( $id, 'spam', '0' ); 158 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); 159 160 break; 161 115 162 case 'allusers': 116 163 if ( !current_user_can( 'manage_network_users' ) ) 117 164 wp_die( __( 'You do not have permission to access this page.' ) ); … … 123 170 $userfunction = ''; 124 171 125 172 foreach ( (array) $_POST['allusers'] as $key => $val ) { 173 126 174 if ( !empty( $val ) ) { 175 176 $user = get_userdata( intval( $val ) ); 177 178 if ( false === $user || is_super_admin( $user->ID ) ) 179 continue; 180 127 181 switch ( $doaction ) { 128 182 case 'delete': 129 183 if ( ! current_user_can( 'delete_users' ) ) … … 139 193 break; 140 194 141 195 case 'spam': 142 $user = get_userdata( $val ); 143 if ( is_super_admin( $user->ID ) ) 144 wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); 145 196 if ( ! current_user_can( 'edit_users' ) ) 197 wp_die( __( 'You do not have permission to access this page.' ) ); 146 198 $userfunction = 'all_spam'; 147 199 $blogs = get_blogs_of_user( $val, true ); 148 foreach ( (array) $blogs as $key => $details ) { 149 if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! 200 if ( $mark_sites_for_spam_user ) { 201 foreach ( (array) $blogs as $key => $details ) { 202 // do not mark main site 203 if ( $details->userblog_id == $current_site->blog_id ) 204 continue; 205 // only if admin email is same as user 206 if ( $user->data->user_email != get_blog_option ( $details->userblog_id , 'admin_email' ) ) 207 continue; 150 208 update_blog_status( $details->userblog_id, 'spam', '1' ); 209 } 151 210 } 152 211 update_user_status( $val, 'spam', '1' ); 153 212 break; 154 213 155 214 case 'notspam': 215 if ( ! current_user_can( 'edit_users' ) ) 216 wp_die( __( 'You do not have permission to access this page.' ) ); 156 217 $userfunction = 'all_notspam'; 157 $blogs = get_blogs_of_user( $val, true );158 foreach ( (array) $blogs as $key => $details )159 update_blog_status( $details->userblog_id, 'spam', '0' );160 218 161 219 update_user_status( $val, 'spam', '0' ); 162 220 break;