Ticket #20774: 20774.colors.diff
File 20774.colors.diff, 6.1 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/class-wp-ms-users-list-table.php
186 186 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 187 187 188 188 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 189 if ( 0 == $user->spam ) 190 $actions['spamuser'] = '<span class="spam"><a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'spamuser' ) . '&action=spamuser&id=' . $user->ID ) ) ) . '" class="spam">' . __( 'Spam' ) . '</a></span>'; 191 else 192 $actions['unspamuser'] = '<span class="spam"><a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'unspamuser' ) . '&action=unspamuser&id=' . $user->ID ) ) ) . '" class="spam">' . __( 'Not Spam' ) . '</a></span>'; 189 193 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 190 194 } 191 195 -
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' , true , $val ); 91 93 92 94 switch ( $_GET['action'] ) { 93 95 case 'deleteuser': … … 111 113 } 112 114 exit(); 113 115 break; 114 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 122 check_admin_referer( 'spamuser' ); 123 $id = intval( $_GET['id'] ); 124 $blogs = get_blogs_of_user( $id, true ); 125 if ( $mark_sites_for_spam_user ) { 126 127 foreach ( (array) $blogs as $key => $details ) { 128 // do not mark main site 129 if ( $details->userblog_id == $current_site->blog_id ) 130 continue; 131 // only if admin email is same as user 132 if ( $user->data->user_email != get_blog_option ( $details->userblog_id , 'admin_email' ) ) 133 continue; 134 update_blog_status( $details->userblog_id, 'spam', '1' ); 135 } 136 } 137 update_user_status( $id, 'spam', '1' ); 138 139 break; 140 141 case 'unspamuser' : 142 if ( ! current_user_can( 'edit_users' ) ) 143 wp_die( __( 'You do not have permission to access this page.' ) ); 144 145 check_admin_referer( 'unspamuser' ); 146 $id = intval( $_GET['id'] ); 147 $blogs = get_blogs_of_user( $id, true ); 148 if ( $mark_sites_for_spam_user ) { 149 foreach ( (array) $blogs as $key => $details ) { 150 // do not mark main site 151 if ( $details->userblog_id == $current_site->blog_id ) 152 continue; 153 // only if admin email is same as user 154 if ( $user->data->user_email != get_blog_option ( $details->userblog_id , 'admin_email' ) ) 155 continue; 156 update_blog_status( $details->userblog_id, 'spam', '0' ); 157 } 158 } 159 update_user_status( $id, 'spam', '0' ); 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( $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 218 $blogs = get_blogs_of_user( $val, true ); 158 foreach ( (array) $blogs as $key => $details ) 159 update_blog_status( $details->userblog_id, 'spam', '0' ); 160 219 if ( $mark_sites_for_spam_user ) { 220 foreach ( (array) $blogs as $key => $details ) { 221 // do not mark main site 222 if ( $details->userblog_id == $current_site->blog_id ) 223 continue; 224 // only if admin email is same as user 225 if ( $user->data->user_email != get_blog_option ( $details->userblog_id , 'admin_email' ) ) 226 continue; 227 update_blog_status( $details->userblog_id, 'spam', '0' ); 228 } 229 } 161 230 update_user_status( $val, 'spam', '0' ); 162 231 break; 163 232 }