• 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::check_db_comment() –

You appear to be a bot. Output may be restricted

Description

Usage

Akismet::check_db_comment( $id, $recheck_reason );

Parameters

$id
( mixed ) required –
$recheck_reason
( mixed ) optional default: recheck_queue –

Returns

void

Source

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

1 to 38 of 38
  public static function check_db_comment( $id, $recheck_reason = 'recheck_queue' ) {
    global $wpdb;

    if ( ! self::get_api_key() ) {
      return new WP_Error( 'akismet-not-configured', __( 'Akismet is not configured. Please enter an API key.', 'akismet' ) );
    }

    $c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->comments} WHERE comment_ID = %d", $id ), ARRAY_A );
    
    if ( ! $c ) {
      return new WP_Error( 'invalid-comment-id', __( 'Comment not found.', 'akismet' ) );
    }

    $c['user_ip']        = $c['comment_author_IP'];
    $c['user_agent']     = $c['comment_agent'];
    $c['referrer']       = '';
    $c['blog']           = get_option( 'home' );
    $c['blog_lang']      = get_locale();
    $c['blog_charset']   = get_option('blog_charset');
    $c['permalink']      = get_permalink($c['comment_post_ID']);
    $c['recheck_reason'] = $recheck_reason;

    $c['user_role'] = '';
    if ( ! empty( $c['user_ID'] ) ) {
      $c['user_role'] = Akismet::get_user_roles( $c['user_ID'] );
    }

    if ( self::is_test_mode() )
      $c['is_test'] = 'true';

    $response = self::http_post( Akismet::build_query( $c ), 'comment-check' );

    if ( ! empty( $response[1] ) ) {
      return $response[1];
    }

    return false;
  }
 

 View on GitHub View on Trac

Published: 19th December 2019 | Last updated: 3rd April 2020

Primary Sidebar

Information

Function name: Akismet::check_db_comment
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,D

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