• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / Akismet::auto_check_update_meta() –

You appear to be a bot. Output may be restricted

Description

Usage

Akismet::auto_check_update_meta( $id, $comment );

Parameters

$id
( mixed ) required –
$comment
( mixed ) required –

Returns

void

Source

File name: akismet/class.akismet.php
Lines:

1 to 58 of 58
  public static function auto_check_update_meta( $id, $comment ) {
    // wp_insert_comment() might be called in other contexts, so make sure this is the same comment
    // as was checked by auto_check_comment
    if ( is_object( $comment ) && !empty( self::$last_comment ) && is_array( self::$last_comment ) ) {
      if ( self::matches_last_comment( $comment ) ) {
        load_plugin_textdomain( 'akismet' );

        // normal result: true or false
        if ( self::$last_comment['akismet_result'] == 'true' ) {
          update_comment_meta( $comment->comment_ID, 'akismet_result', 'true' );
          self::update_comment_history( $comment->comment_ID, '', 'check-spam' );
          if ( $comment->comment_approved != 'spam' ) {
            self::update_comment_history(
              $comment->comment_ID,
              '',
              'status-changed-' . $comment->comment_approved
            );
          }
        } elseif ( self::$last_comment['akismet_result'] == 'false' ) {
          update_comment_meta( $comment->comment_ID, 'akismet_result', 'false' );
          self::update_comment_history( $comment->comment_ID, '', 'check-ham' );
          // Status could be spam or trash, depending on the WP version and whether this change applies:
          // https://core.trac.wordpress.org/changeset/34726
          if ( $comment->comment_approved == 'spam' || $comment->comment_approved == 'trash' ) {
            if ( function_exists( 'wp_check_comment_disallowed_list' ) ) {
              if ( wp_check_comment_disallowed_list( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent ) ) {
                self::update_comment_history( $comment->comment_ID, '', 'wp-disallowed' );
              } else {
                self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved );
              }
            } else if ( function_exists( 'wp_blacklist_check' ) && wp_blacklist_check( $comment->comment_author, $comment->comment_author_email, $comment->comment_author_url, $comment->comment_content, $comment->comment_author_IP, $comment->comment_agent ) ) {
              self::update_comment_history( $comment->comment_ID, '', 'wp-blacklisted' );
            } else {
              self::update_comment_history( $comment->comment_ID, '', 'status-changed-' . $comment->comment_approved );
            }
          }
        } else {
           // abnormal result: error
          update_comment_meta( $comment->comment_ID, 'akismet_error', time() );
          self::update_comment_history(
            $comment->comment_ID,
            '',
            'check-error',
            array( 'response' => substr( self::$last_comment['akismet_result'], 0, 50 ) )
          );
        }

        // record the complete original data as submitted for checking
        if ( isset( self::$last_comment['comment_as_submitted'] ) ) {
          update_comment_meta( $comment->comment_ID, 'akismet_as_submitted', self::$last_comment['comment_as_submitted'] );
        }

        if ( isset( self::$last_comment['akismet_pro_tip'] ) ) {
          update_comment_meta( $comment->comment_ID, 'akismet_pro_tip', self::$last_comment['akismet_pro_tip'] );
        }
      }
    }
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 10th December 2020

Primary Sidebar

Information

Function name: Akismet::auto_check_update_meta
Class ref: Akismet
Plugin ref: Akismet
Version: 5.0.1
Sourcefile: class.akismet.php
File ref: class.akismet.php
Deprecated?: No
API Letters: A,C,M,U

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites