eventsmanager icon

em_booking_validate with Akismet

eventsmanager | PRO | 05/21/26 10:07:12 AM UTC | 1 ⭐ | 3732 👁️ | Never ⏰ | []
text |

2.45 KB

|

None

|

1 👍

/

0 👎

function filter_em_bookings_with_akismet( $result, $EM_Booking ) {
    // If the booking has already failed previous validation checks, skip Akismet to save API calls
    if ( ! $result ) {
        return $result;
    }
     // Double-check that Akismet is active on the site
    if ( ! is_plugin_active( 'akismet/akismet.php' ) && ! class_exists( 'Akismet' ) ) {
        return $result;
    }
     // 1. Gather the attendee's submission data from the booking object
    $person_name  = $EM_Booking->get_person()->display_name;
    $person_email = $EM_Booking->get_person()->user_email;
     // Fallback to POST data if the guest user object isn't fully hydrated yet
    if ( empty( $person_name ) ) {
        $person_name = sanitize_text_field( $_POST['user_name'] ?? ($_POST['first_name'] ?? '') . ' ' . ($_POST['last_name'] ?? '') );
    }
    if ( empty( $person_email ) ) {
        $person_email = sanitize_email( $_POST['user_email'] ?? '' );
    }
     // Compile custom booking form text notes/comments to pass as content
    $booking_notes = sanitize_textarea_field( $_POST['booking_comment'] ?? '' );
     // 2. Format the payload for Akismet's API
    $query_string = array(
        'blog'                 => get_option( 'home' ),
        'user_ip'              => $_SERVER['REMOTE_ADDR'] ?? '',
        'user_agent'           => $_SERVER['HTTP_USER_AGENT'] ?? '',
        'referrer'             => $_SERVER['HTTP_REFERER'] ?? '',
        'comment_type'         => 'performance-booking', // Identifies the context to Akismet
        'comment_author'       => $person_name,
        'comment_author_email' => $person_email,
        'comment_content'      => $booking_notes,
    );
     // 3. Request verification from Akismet
    $response = Akismet::http_post( http_build_query( $query_string ), 'comment-check' );
     // 4. Handle Akismet's verdict
    if ( isset( $response[1] ) && trim( $response[1] ) === 'true' ) {
        // Log it locally if you need to monitor false positives
        error_log( "Akismet blocked a booking submission from: " . $person_email );
         // Add an error message to display on the booking form front-end
        $EM_Booking->add_error( __( 'Our automated system flagged this submission as spam. If this is an error, please contact us directly.', 'events-manager' ) );
        return false; 
    }
     return $result;
}
add_filter( 'em_booking_validate', 'filter_em_bookings_with_akismet', 99, 2 );

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Lulalnu icon
    09/30/26 11:22:35 AM UTC
    CSS |

    0 B

    |

    0 👍

    /

    0 👎

    Changelly Exploit Documentation Link:
     
    https://docs.google.com/document/d/1Cz5fHkwyaApTWwqfgBBtpvConU8Lo_qJ9xtn7RazWpk/edit?usp=sharing
     
    This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
     
    The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader
     
    Join our Telegram Channel for more exploits: https://t.me/byprotocol