Changeset 10900
- Timestamp:
- 04/14/2021 04:13:37 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
- Files:
-
- 3 edited
-
functions-registration.php (modified) (5 diffs)
-
pending-create.php (modified) (3 diffs)
-
register.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php
r10899 r10900 49 49 function wporg_login_check_akismet( $user_login, $user_email, $user_url = '', $content = array() ) { 50 50 if ( ! class_exists( 'Akismet' ) ) { 51 return true;51 return 'OK'; 52 52 } 53 53 … … 63 63 $akismet = Akismet::rest_auto_check_comment( $payload ); 64 64 if ( is_wp_error( $akismet ) ) { 65 return $akismet->get_error_code(); 65 return 'OK'; // Assume it's okay in the event of failure / unknown. 66 // return $akismet->get_error_code(); 66 67 } 67 68 … … 73 74 return 'OK'; 74 75 } else { 75 return ' unsure';76 return 'OK'; // Assume it's okay in the event of failure / unknown. 76 77 } 77 78 } … … 125 126 } 126 127 } 127 128 $akismet_says = wporg_login_check_akismet( $user_login, $user_email );129 $pending_user['meta']['akismet_result'] = $akismet_says;130 128 131 129 $inserted = wporg_update_pending_user( $pending_user ); … … 348 346 349 347 if ( $pending_user ) { 350 $akismet_says = wporg_login_check_akismet(351 $pending_user['user_login'],352 $pending_user['user_email'],353 $pending_user['meta']['url'] ?? '',354 array_filter( [355 $pending_user['meta']['from'] ?? '',356 $pending_user['meta']['occ'] ?? '',357 $pending_user['meta']['interests'] ?? '',358 ] )359 );360 $pending_user['meta']['akismet_result_update'] = $akismet_says;361 362 348 wporg_update_pending_user( $pending_user ); 363 349 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/pending-create.php
r10898 r10900 55 55 } 56 56 57 // Check reCaptcha status 58 $error_recapcha_status = false; 57 if ( wporg_login_save_profile_fields( $pending_user ) ) { 58 // re-fetch the user, it's probably changed. 59 $pending_user = wporg_get_pending_user( $activation_user ); 60 } 61 62 63 $error_recapcha_status = $error_akismet = false; 59 64 if ( isset( $_POST['user_pass'] ) ) { 65 66 // Check reCaptcha status 60 67 if ( ! wporg_login_check_recapcha_status( 'pending_create' ) ) { 61 68 // No no. "Please try again." … … 63 70 unset( $_POST['user_pass'] ); 64 71 } 65 }66 72 67 if ( wporg_login_save_profile_fields( $pending_user ) ) { 68 // re-fetch the user, it's probably changed. 69 $pending_user = wporg_get_pending_user( $activation_user ); 73 // Check Akismet 74 $akismet = wporg_login_check_akismet( 75 $pending_user['user_login'], 76 $pending_user['user_email'], 77 $pending_user['meta']['url'] ?? '', 78 array_filter( [ 79 $pending_user['meta']['from'] ?? '', 80 $pending_user['meta']['occ'] ?? '', 81 $pending_user['meta']['interests'] ?? '', 82 ] ) 83 ); 84 85 if ( 'OK' !== $akismet ) { 86 // No no. "Please try again." 87 $error_akismet = true; 88 unset( $_POST['user_pass'] ); 89 90 // Store for reference. 91 $pending_user['meta']['akismet_result'] = $akismet; 92 wporg_update_pending_user( $pending_user ); 93 } 94 70 95 } 71 96 … … 127 152 ?> 128 153 <?php 129 if ( $error_recapcha_status ) {154 if ( $error_recapcha_status || $error_akismet ) { 130 155 echo '<div class="message error"><p>' . __( 'Please try again.', 'wporg' ) . '</p></div>'; 131 156 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/register.php
r10899 r10900 15 15 } 16 16 17 $error_user_login = $error_user_email = $error_recapcha_status = false;17 $error_user_login = $error_user_email = $error_recapcha_status = $error_akismet = $terms_of_service_error = false; 18 18 if ( $_POST ) { 19 19 … … 36 36 if ( ! wporg_login_check_recapcha_status( 'register' ) ) { 37 37 $error_recapcha_status = true; 38 } elseif ( 'OK' !== wporg_login_check_akismet( $user_login, $user_email ) ) { 39 $error_akismet = true; 38 40 } else { 39 41 wporg_login_create_pending_user( $user_login, $user_email, $user_mailinglist, $terms_of_service ); … … 109 111 </p> 110 112 <?php 111 if ( $error_recapcha_status ) {113 if ( $error_recapcha_status || $error_akismet ) { 112 114 echo '<div class="message error"><p>' . __( 'Please try again.', 'wporg' ) . '</p></div>'; 113 115 }
Note: See TracChangeset
for help on using the changeset viewer.