Changeset 11623
- Timestamp:
- 03/02/2022 07:51:58 AM (3 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r11350 r11623 1336 1336 $user_has_blocked_role = ! empty( $user->roles ) && in_array( $blocked_role, $user->roles, true ); 1337 1337 1338 // Define what has blocked the user. 1339 if ( ! ms_is_switched() ) { 1340 $where_from = preg_replace( '!^https?://!i', '', home_url( is_admin() ? '/wp-admin' : '' ) ); 1341 } else { 1342 // When we're switched, we can't determine the source of the switch, so we use a bit of URL parsing magic. 1343 $where_from = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; 1344 if ( str_contains( $where_from, '?' ) ) { 1345 list( $where_from, ) = explode( '?', $where_from ); 1346 } 1347 // Trim actual filename off, just the major path component. 1348 $where_from = preg_replace( '!/[^/?]+\.[a-z]{3}$!i', '', $where_from ); 1349 } 1350 1338 1351 if ( 1339 1352 ( $blocked_role === $new_role || $user_has_blocked_role ) && … … 1360 1373 // Add a user note about this action. 1361 1374 $note_text = sprintf( 1362 'Forum role changed to %s.', 1363 get_role( $new_role )->name 1375 $where_from ? 'Forum role changed to %s via %s.' : 'Forum role changed to %s.', 1376 get_role( $new_role )->name, 1377 $where_from 1364 1378 ); 1379 1380 // Used in wporg-login to add context. 1381 $note_text = apply_filters( 'wporg_bbp_forum_role_changed_note_text', $note_text, $user ); 1365 1382 } else if ( 1366 1383 $password_broken && … … 1383 1400 // Add a user note about this action. 1384 1401 $note_text = sprintf( 1385 'Forum role changed to %s.', 1386 get_role( $new_role )->name 1402 $where_from ? 'Forum role changed to %s via %s.' : 'Forum role changed to %s.', 1403 get_role( $new_role )->name, 1404 $where_from 1387 1405 ); 1406 1407 // Unused, here for consistency with above. 1408 $note_text = apply_filters( 'wporg_bbp_forum_role_changed_note_text', $note_text, $user ); 1388 1409 } 1389 1410 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php
r11622 r11623 312 312 } else { 313 313 $url = add_query_arg( 314 'user _id',315 urlencode( $item->user-> ID),314 'user', 315 urlencode( $item->user->user_login ), 316 316 admin_url( 'admin-post.php?action=login_block_account' ) 317 317 ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/ui.php
r11622 r11623 140 140 if ( $block_words ) { 141 141 $block_words = explode( "\n", $block_words ); 142 $block_words = array_values( array_unique( array_filter( array_map( 'trim', $block_words )) ) );142 $block_words = array_values( array_unique( array_filter( $block_words ) ) ); 143 143 144 144 // Sanity; Don't let it change more than 20%. … … 190 190 '<tr> 191 191 <th>reCaptcha v3 low-score threshold for Registration</th> 192 <td><input name="recaptcha_v3_threshold" type="number" min="0.0" max="1.0" step="0.1" name="" value="%s"></td> 192 <td> 193 <input name="recaptcha_v3_threshold" type="number" min="0.0" max="1.0" step="0.1" name="" value="%s"> 194 <p><em>Any reCaptcha v3 score lower than this threshold is considered to have failed the reCaptcha and will be put into manual review.</em></p> 195 </td> 193 196 </tr>', 194 197 esc_attr( get_option( 'recaptcha_v3_threshold', 0.2 ) ) … … 200 203 <td> 201 204 <textarea name="registration_block_words" rows="10" cols="80">%s</textarea> 202 <p><em>Any registrations with any of these phrases within their username, email address, or profile fields will be put into manual review. One phrase per line.</em></p> 205 <p> 206 <em>Any registrations with any of these phrases within their username, email address, or profile fields will be put into manual review.</em><br> 207 <em>Multiple words allowed to form a phrase. Leading/trailing whitespace is not removed. One phrase per line.</em> 208 </p> 203 209 </td> 204 210 </tr>', … … 356 362 } 357 363 358 if ( empty( $_REQUEST['user _id'] ) ) {364 if ( empty( $_REQUEST['user'] ) ) { 359 365 die(); 360 366 } 361 367 362 $user_id = (int) $_REQUEST['user_id']; 363 364 check_admin_referer( 'block_account_' . $user_id ); 365 366 if ( $user_id && defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) ) { 368 $pending_user = wporg_get_pending_user( $_REQUEST['user'] ); 369 if ( ! $pending_user || ! $pending_user['created'] ) { 370 die(); 371 } 372 373 $user = get_user_by( 'slug', $pending_user['user_login'] ); 374 if ( ! $user ) { 375 die(); 376 } 377 378 $table = new User_Registrations_List_Table(); 379 380 ob_start(); 381 $pending_as_object = (object) $pending_user; 382 $pending_as_object->meta = (object) $pending_as_object->meta; 383 $pending_as_object->user = $user; 384 385 unset( $pending_as_object->meta->registration_ip, $pending_as_object->meta->confirmed_ip ); 386 387 $table->column_meta( $pending_as_object ); 388 $meta_column = ob_get_clean(); 389 $meta_column = wp_strip_all_tags( str_replace( '<br>', "\n", $meta_column ), false ); 390 391 check_admin_referer( 'block_account_' . $user->ID ); 392 393 if ( $user && defined( 'WPORG_SUPPORT_FORUMS_BLOGID' ) ) { 367 394 368 395 // Switch first so that bbPress loads with the correct context. … … 379 406 switch_to_blog( WPORG_SUPPORT_FORUMS_BLOGID ); 380 407 408 add_filter( 'wporg_bbp_forum_role_changed_note_text', function( $text ) use ( $meta_column ) { 409 return trim( "{$meta_column}\n\n{$text}" ); 410 } ); 411 381 412 // Set the user to blocked. Support forum hooks will take care of the rest. 382 bbp_set_user_role( $user _id, bbp_get_blocked_role() );413 bbp_set_user_role( $user->ID, bbp_get_blocked_role() ); 383 414 384 415 restore_current_blog();
Note: See TracChangeset
for help on using the changeset viewer.