Making WordPress.org


Ignore:
Timestamp:
04/14/2021 04:49:37 AM (5 years ago)
Author:
dd32
Message:

Login: Store Akismet result for each signup, and expose it within the Admin UI.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php

    r10900 r10901  
    6363    $akismet = Akismet::rest_auto_check_comment( $payload );
    6464    if ( is_wp_error( $akismet ) ) {
    65         return 'OK'; // Assume it's okay in the event of failure / unknown.
    66         // return $akismet->get_error_code();
    67     }
    68 
    69     if ( ! empty( $akismet['akismet_pro_tip'] ) ) {
    70         return $akismet['akismet_pro_tip'];
     65        return $akismet->get_error_code();
     66    }
     67
     68    if ( ! empty( $akismet['akismet_pro_tip'] ) && 'discard' === $akismet['akismet_pro_tip'] ) {
     69        return 'spam';
    7170    } elseif ( 'true' === $akismet['akismet_result'] ) {
    7271        return 'spam';
     
    7473        return 'OK';
    7574    } else {
    76         return 'OK'; // Assume it's okay in the event of failure / unknown.
     75        return 'unknown';
    7776    }
    7877}
     
    8180 * Handles creating a "Pending" registration that will later be converted to an actual user  account.
    8281 */
    83 function wporg_login_create_pending_user( $user_login, $user_email, $user_mailinglist = false, $tos_revision = 0 ) {
     82function wporg_login_create_pending_user( $user_login, $user_email, $meta = array() ) {
    8483    global $wpdb, $wp_hasher;
    8584
     
    9897    $profile_key        = wp_generate_password( 24, false, false );
    9998    $hashed_profile_key = time() . ':' . wp_hash_password( $profile_key );
    100 
    101     $tos_meta_key = WPOrg_SSO::TOS_USER_META_KEY;
    10299
    103100    $pending_user = array(
     
    107104        'user_activation_key' => '',
    108105        'user_profile_key' => $hashed_profile_key,
    109         'meta' => array(
    110             'user_mailinglist' => $user_mailinglist,
     106        'meta' => $meta + array(
    111107            'registration_ip'  => $_SERVER['REMOTE_ADDR'], // Spam & fraud control. Will be discarded after the account is created.
    112             $tos_meta_key      => $tos_revision,
    113108        ),
    114109        'scores' => array()
Note: See TracChangeset for help on using the changeset viewer.