Changeset 11620 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
- Timestamp:
- 03/02/2022 06:07:14 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r11505 r11620 46 46 47 47 /** 48 * Handles creating a "Pending" registration that will later be converted to an actual user account.48 * Handles creating a "Pending" registration that will later be converted to an actual user account. 49 49 */ 50 50 function wporg_login_create_pending_user( $user_login, $user_email, $meta = array() ) { … … 96 96 } 97 97 98 $passes_block_words = wporg_login_check_against_block_words( $pending_user ); 99 98 100 $pending_user['cleared'] = ( 99 101 'allow' === $pending_user['meta']['heuristics'] && 100 (float)$pending_user['scores']['pending'] >= (float) get_option( 'recaptcha_v3_threshold', 0.2 ) 102 (float)$pending_user['scores']['pending'] >= (float) get_option( 'recaptcha_v3_threshold', 0.2 ) && 103 $passes_block_words 101 104 ); 102 105 … … 398 401 } 399 402 403 // If not manually approved, check against block_words. 404 if ( $pending_user['cleared'] < 2 ) { 405 $passes_block_words = wporg_login_check_against_block_words( $pending_user ); 406 if ( ! $passes_block_words ) { 407 $pending_user['cleared'] = 0; 408 } 409 } 410 400 411 if ( $pending_user ) { 401 412 wporg_update_pending_user( $pending_user ); … … 407 418 return true; 408 419 } 420 421 /** 422 * Check a pending user object against the 'block words' setting. 423 * 424 * @return bool 425 */ 426 function wporg_login_check_against_block_words( $user ) { 427 $block_words = get_option( 'registration_block_words', [] ); 428 429 foreach ( $block_words as $word ) { 430 if ( 431 false !== stripos( $user['user_login'], $word ) || 432 false !== stripos( $user['user_email'], $word ) || 433 false !== stripos( $user['meta']['url'], $word ) || 434 false !== stripos( $user['meta']['from'], $word ) || 435 false !== stripos( $user['meta']['occ'], $word ) || 436 false !== stripos( $user['meta']['interests'], $word ) 437 ) { 438 return false; 439 } 440 } 441 442 return true; 443 }
Note: See TracChangeset
for help on using the changeset viewer.