Changeset 10890
- Timestamp:
- 04/13/2021 07:48:42 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r10288 r10890 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 ) { 50 if ( ! class_exists( 'Akismet' ) ) { 51 return true; 52 } 53 54 $payload = [ 55 'type' => 'user_signup', 56 'comment_author' => $user_login, 57 'comment_author_email' => $user_email, 58 'comment_post_ID' => 0, 59 ]; 60 61 $akismet = Akismet::rest_auto_check_comment( $c ); 62 if ( is_wp_error( $akismet ) ) { 63 return $akismet->get_error_code(); 64 } 65 66 if ( ! empty( $akismet['akismet_pro_tip'] ) ) { 67 return $akismet['akismet_pro_tip']; 68 } elseif ( 'true' === $akismet['akismet_result'] ) { 69 return 'spam'; 70 } elseif ( 'false' === $akismet['akismet_result'] ) { 71 return 'OK'; 72 } else { 73 return 'unsure'; 74 } 44 75 } 45 76 … … 88 119 $pending_user['scores']['pending'] = $recaptcha_api['score']; 89 120 } 90 91 } 121 } 122 123 $akismet_says = wporg_login_check_akismet( $user_login, $user_email ); 124 $pending_user['meta']['akismet_result'] = $akismet_says; 92 125 93 126 $inserted = wporg_update_pending_user( $pending_user );
Note: See TracChangeset
for help on using the changeset viewer.