__( 'Login Locked Out', 'advanced-form-integration' ), ); } // Get AIOS Fields function adfoin_aiowpsecurity_get_form_fields( $form_provider, $form_id ) { if ( $form_provider !== 'aiowpsecurity' || $form_id !== 'loginLockout' ) { return; } return array( 'username' => __( 'Attempted Username', 'advanced-form-integration' ), 'user_email' => __( 'User Email (only if the username matches a real account)', 'advanced-form-integration' ), 'ip_address' => __( 'IP Address / Range', 'advanced-form-integration' ), 'lockout_time' => __( 'Lockout Time', 'advanced-form-integration' ), ); } // Handle Login Lockout function adfoin_aiowpsecurity_handle_lockout( $ip_range, $username ) { $integration = new Advanced_Form_Integration_Integration(); $saved_records = $integration->get_by_trigger( 'aiowpsecurity', 'loginLockout' ); if ( empty( $saved_records ) ) { return; } // Best-effort: most brute-force attempts use usernames that don't map to // a real account, so this frequently comes back empty — that's expected. $user = $username ? get_user_by( 'login', $username ) : false; $posted_data = array( 'username' => $username, 'user_email' => $user ? $user->user_email : '', 'ip_address' => $ip_range, 'lockout_time' => current_time( 'mysql' ), ); adfoin_dispatch_integrations( $saved_records, $posted_data ); }