akismet_submit_spam_comment

Definition:
function akismet_submit_spam_comment ( $comment_id ) {}

Parameters

  • $comment_id

Defined actions

  • akismet_submit_spam_comment
    do_action('akismet_submit_spam_comment', $comment_id, $response[1]);

Source code

function akismet_submit_spam_comment ( $comment_id ) {

	global $wpdb, $akismet_api_host, $akismet_api_port, $current_user, $current_site;

	$comment_id = (int) $comment_id;



	$comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_id'");

	if ( !$comment ) // it was deleted

		return;

	if ( 'spam' != $comment->comment_approved )

		return;

	

	// use the original version stored in comment_meta if available	

	$as_submitted = get_comment_meta( $comment_id, 'akismet_as_submitted', true);

	if ( $as_submitted && is_array($as_submitted) && isset($as_submitted['comment_content']) ) {

		$comment = (object) array_merge( (array)$comment, $as_submitted );

	}

	

	$comment->blog = get_bloginfo('url');

	$comment->blog_lang = get_locale();

	$comment->blog_charset = get_option('blog_charset');

	$comment->permalink = get_permalink($comment->comment_post_ID);

	$comment->reporter_ip = $_SERVER['REMOTE_ADDR'];

	if ( is_object($current_user) ) {

	    $comment->reporter = $current_user->user_login;

	}

	if ( is_object($current_site) ) {

		$comment->site_domain = $current_site->domain;

	}



	$comment->user_role = '';

	if ( isset( $comment->user_ID ) )

		$comment->user_role = akismet_get_user_roles($comment->user_ID);



	if ( akismet_test_mode() )

		$comment->is_test = 'true';



	$query_string = '';

	foreach ( $comment as $key => $data )

		$query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&';



	$response = akismet_http_post($query_string, $akismet_api_host, "/1.1/submit-spam", $akismet_api_port);

	if ( $comment->reporter ) {

		akismet_update_comment_history( $comment_id, sprintf( __('%s reported this comment as spam'), $comment->reporter ), 'report-spam' );

		update_comment_meta( $comment_id, 'akismet_user_result', 'true' );

		update_comment_meta( $comment_id, 'akismet_user', $comment->reporter );

	}

	do_action('akismet_submit_spam_comment', $comment_id, $response[1]);

}

517

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: