Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass donor comment content to Akismet api request when doing spam validation #3768 #3771

Merged
merged 2 commits into from
Oct 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions includes/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ function give_akismet( $spam ) {
// Build args array.
$args = array();

$args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : '';
$args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false;
$args['comment_author'] = isset( $_POST['give_first'] ) ? give_clean( $_POST['give_first'] ) : '';
$args['comment_author_email'] = isset( $_POST['give_email'] ) ? sanitize_email( $_POST['give_email'] ) : false;
$args['blog'] = get_option( 'home' );
$args['blog_lang'] = get_locale();
$args['blog_charset'] = get_option( 'blog_charset' );
Expand All @@ -105,6 +105,15 @@ function give_akismet( $spam ) {
$args['referrer'] = $_SERVER['HTTP_REFERER'];
$args['comment_type'] = 'contact-form';

$form_id = isset( $_POST['give-form-id'] ) ? absint( $_POST['give-form-id'] ) : 0;

// Pass Donor comment if enabled.
if ( give_is_donor_comment_field_enabled( $form_id ) ) {
$give_comment = isset( $_POST['give_comment'] ) ? give_clean( $_POST['give_comment'] ) : '';

$args['comment_content'] = $give_comment;
}

$ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );

foreach ( $_SERVER as $key => $value ) {
Expand Down