Changeset 10964
- Timestamp:
- 05/11/2021 05:19:18 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
- Files:
-
- 3 edited
-
admin/class-user-registrations-list-table.php (modified) (3 diffs)
-
functions-registration.php (modified) (3 diffs)
-
pending-create.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php
r10961 r10964 24 24 ], 25 25 [ 26 ' akismet',27 ' Akismet said no',28 ], 29 [ 30 'heuristics ',31 'He iristics: Review /Block',26 'heuristics-review', 27 'Heuristics: Review', 28 ], 29 [ 30 'heuristics-block', 31 'Heuristics: Block', 32 32 ] 33 33 ]; … … 84 84 case 'akismet': 85 85 return "meta LIKE '%akismet_result\":\"spam%'"; 86 case 'heuristics': 87 return "meta LIKE '%heuristics%' AND meta NOT LIKE '%heuristics\":\"allow%'"; 86 case 'heuristics-allow': 87 return "meta LIKE '%heuristics\":\"allow%'"; 88 case 'heuristics-review': 89 return "meta LIKE '%heuristics\":\"review%'"; 90 case 'heuristics-block': 91 return "meta LIKE '%heuristics\":\"block%'"; 88 92 case 'registered': 89 93 return 'created = 1'; … … 271 275 272 276 } 273 274 277 275 278 function column_meta( $item ) { -
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 ); -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-create.php
r10948 r10964 82 82 $pending_user['cleared'] = 0; 83 83 } 84 }85 86 // Check Akismet with new profile information87 $pending_user['meta']['akismet_result'] = wporg_login_check_akismet(88 $pending_user['user_login'],89 $pending_user['user_email'],90 $pending_user['meta']['url'] ?? '',91 array_filter( [92 $pending_user['meta']['from'] ?? '',93 $pending_user['meta']['occ'] ?? '',94 $pending_user['meta']['interests'] ?? '',95 ] )96 );97 98 if ( 'spam' === $pending_user['meta']['akismet_result'] ) {99 $pending_user['cleared'] = 0;100 unset( $_POST['user_pass'] );101 84 } 102 85
Note: See TracChangeset
for help on using the changeset viewer.