Ticket #1275: grunion-akismet-trunk-fix.diff
| File grunion-akismet-trunk-fix.diff, 2.1 KB (added by davecpage, 2 years ago) |
|---|
-
grunion-contact-form.php
390 390 391 391 $contact_form_values = compact( $vars ); 392 392 393 if ( function_exists( 'akismet_http_post' ) ) { 394 $spam = ''; 395 $akismet_values = contact_form_prepare_for_akismet( $contact_form_values ); 396 $is_spam = contact_form_is_spam_akismet( $akismet_values ); 397 if ( is_wp_error( $is_spam ) ) 398 return; // abort 399 else if ( $is_spam ) 400 $spam = '***SPAM*** '; 401 } 393 $spam = ''; 394 $akismet_values = contact_form_prepare_for_akismet( $contact_form_values ); 395 $is_spam = apply_filters( 'contact_form_is_spam', $result = false, $akismet_values ); 396 if ( is_wp_error( $is_spam ) ) 397 return; // abort 398 else if ( $is_spam ) 399 $spam = '***SPAM*** '; 402 400 403 401 if ( !$comment_author ) 404 402 $comment_author = $comment_author_email; … … 559 557 } 560 558 561 559 function contact_form_init() { 562 if ( function_exists( 'akismet_http_post' ) ) 560 if ( function_exists( 'akismet_http_post' ) ) { 563 561 add_filter( 'contact_form_is_spam', 'contact_form_is_spam_akismet', 10, 2 ); 562 add_action( 'contact_form_akismet', 'contact_form_akismet_submit', 10, 2 ); 563 } 564 564 if ( !has_filter( 'widget_text', 'do_shortcode' ) ) 565 565 add_filter( 'widget_text', 'contact_form_widget_shortcode_hack', 5 ); 566 566 -
admin.php
425 425 $post->post_status = 'spam'; 426 426 $status = wp_insert_post( $post ); 427 427 wp_transition_post_status( 'spam', 'publish', $post ); 428 contact_form_akismet_submit('spam', $akismet_values );428 do_action('contact_form_akismet', 'spam', $akismet_values ); 429 429 } elseif ( $_POST['make_it'] == 'ham' ) { 430 430 $post->post_status = 'publish'; 431 431 $status = wp_insert_post( $post ); 432 432 wp_transition_post_status( 'publish', 'spam', $post ); 433 contact_form_akismet_submit('ham', $akismet_values );433 do_action('contact_form_akismet', 'ham', $akismet_values ); 434 434 435 435 // resend the original email 436 436 $email = get_post_meta( $post_id, '_feedback_email', TRUE );
