Changeset 10964 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
- Timestamp:
- 05/11/2021 05:19:18 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
r10961 r10964 42 42 43 43 return (bool) $result['success']; 44 }45 46 /**47 * Check the user registration attempt against Akismet.48 */49 function wporg_login_check_akismet( $user_login, $user_email, $user_url = '', $content = array() ) {50 if ( ! class_exists( 'Akismet' ) ) {51 return 'OK';52 }53 54 $payload = [55 'type' => 'user_signup',56 'comment_author' => $user_login,57 'comment_author_email' => $user_email,58 'comment_author_url' => $user_url,59 'comment_content' => implode( "\n", $content ),60 'comment_post_ID' => 0,61 ];62 63 $akismet = Akismet::rest_auto_check_comment( $payload );64 if ( is_wp_error( $akismet ) ) {65 return $akismet->get_error_code();66 }67 68 if ( ! empty( $akismet['akismet_pro_tip'] ) && 'discard' === $akismet['akismet_pro_tip'] ) {69 return 'spam';70 } elseif ( 'true' === $akismet['akismet_result'] ) {71 return 'spam';72 } elseif ( 'false' === $akismet['akismet_result'] ) {73 return 'OK';74 } else {75 return 'unknown';76 }77 44 } 78 45 … … 122 89 } 123 90 91 $pending_user['meta']['heuristics'] = 'allow'; 124 92 if ( function_exists( 'wporg_registration_check_private_heuristics' ) ) { 125 93 // Returns block, review, allow. … … 127 95 } 128 96 129 $pending_user['meta']['akismet_result'] = wporg_login_check_akismet( $user_login, $user_email );130 131 97 $pending_user['cleared'] = ( 132 // ( !isset( $pending_user['meta']['heuristics'] ) || 'allow' === $pending_user['meta']['heuristics'] ) && // Disabled for now, review results first, replace Akismet below 133 'spam' !== $pending_user['meta']['akismet_result'] && 98 'allow' === $pending_user['meta']['heuristics'] && 134 99 (float)$pending_user['scores']['pending'] >= (float) get_option( 'recaptcha_v3_threshold', 0.2 ) 135 100 );
Note: See TracChangeset
for help on using the changeset viewer.