Making WordPress.org

Changeset 10961


Ignore:
Timestamp:
05/10/2021 05:42:47 AM (6 years ago)
Author:
dd32
Message:

Registration: Introduce a new check on some heuristics to determine if a signup looks spammy.

This is intended to replace the usage of Akismet (which isn't designed for this) to hopefully reduce the number of blocked signups that require manual review.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/admin/class-user-registrations-list-table.php

    r10944 r10961  
    2626                                'akismet',
    2727                                'Akismet said no',
     28                        ],
     29                        [
     30                                'heuristics',
     31                                'Heiristics: Review / Block',
    2832                        ]
    2933                ];
    … …  
    8084                        case 'akismet':
    8185                                return "meta LIKE '%akismet_result\":\"spam%'";
     86                        case 'heuristics':
     87                                return "meta LIKE '%heuristics%' AND meta NOT LIKE '%heuristics\":\"allow%'";
    8288                        case 'registered':
    8389                                return 'created = 1';
    … …  
    317323                }
    318324
     325                $heuristics = $meta->heuristics ?? '';
     326                if ( $heuristics ) {
     327                        printf(
     328                                '<abbr title="%s">%s</abbr> ',
     329                                esc_attr( 'Heuristics' ),
     330                                esc_html( strtolower( $heuristics ) )
     331                        );
     332                }
     333
    319334                $row_actions = [];
    320335
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php

    r10949 r10961  
    122122        }
    123123
     124        if ( function_exists( 'wporg_registration_check_private_heuristics' ) ) {
     125                // Returns block, review, allow.
     126                $pending_user['meta']['heuristics'] = wporg_registration_check_private_heuristics( compact( 'user_login', 'user_email' ) );
     127        }
     128
    124129        $pending_user['meta']['akismet_result'] = wporg_login_check_akismet( $user_login, $user_email );
    125130
    126131        $pending_user['cleared'] = (
     132                // ( !isset( $pending_user['meta']['heuristics'] ) || 'allow' === $pending_user['meta']['heuristics'] ) && // Disabled for now, review results first, replace Akismet below
    127133                'spam' !== $pending_user['meta']['akismet_result'] &&
    128134                (float)$pending_user['scores']['pending'] >= (float) get_option( 'recaptcha_v3_threshold', 0.2 )
    … …  
    213219
    214220        // Cast the int fields to an integer.
    215         foreach ( [ 'pending_id', 'cleared', 'created' ] as $field ) {
    216                 $pending_user[ $field ] = (int) $pending_user[ $field ];
    217         }
     221        $pending_user['pending_id'] = (int) $pending_user['pending_id'];
     222        $pending_user['cleared']    = (int) $pending_user['cleared'];
     223        $pending_user['created']    = (int) $pending_user['created'];
    218224
    219225        return $pending_user;
Note: See TracChangeset for help on using the changeset viewer.