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

You appear to be a bot. Output may be restricted

Description

Usage

Akismet_Admin::comment_row_action( $a, $comment );

Parameters

$a
( mixed ) required –
$comment
( mixed ) required –

Returns

void

Source

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

1 to 59 of 59
  public static function comment_row_action( $a, $comment ) {
    $akismet_result = get_comment_meta( $comment->comment_ID, 'akismet_result', true );
    $akismet_error  = get_comment_meta( $comment->comment_ID, 'akismet_error', true );
    $user_result    = get_comment_meta( $comment->comment_ID, 'akismet_user_result', true);
    $comment_status = wp_get_comment_status( $comment->comment_ID );
    $desc = null;
    if ( $akismet_error ) {
      $desc = __( 'Awaiting spam check' , 'akismet');
    } elseif ( !$user_result || $user_result == $akismet_result ) {
      // Show the original Akismet result if the user hasn't overridden it, or if their decision was the same
      if ( $akismet_result == 'true' && $comment_status != 'spam' && $comment_status != 'trash' )
        $desc = __( 'Flagged as spam by Akismet' , 'akismet');
      elseif ( $akismet_result == 'false' && $comment_status == 'spam' )
        $desc = __( 'Cleared by Akismet' , 'akismet');
    } else {
      $who = get_comment_meta( $comment->comment_ID, 'akismet_user', true );
      if ( $user_result == 'true' )
        $desc = sprintf( __('Flagged as spam by %s', 'akismet'), $who );
      else
        $desc = sprintf( __('Un-spammed by %s', 'akismet'), $who );
    }

    // add a History item to the hover links, just after Edit
    if ( $akismet_result ) {
      $b = array();
      foreach ( $a as $k => $item ) {
        $b[ $k ] = $item;
        if (
          $k == 'edit'
          || $k == 'unspam'
        ) {
          $b['history'] = '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="'. esc_attr__( 'View comment history' , 'akismet') . '"> '. esc_html__('History', 'akismet') . '</a>';
        }
      }

      $a = $b;
    }

    if ( $desc )
      echo '<span class="akismet-status" commentid="'.$comment->comment_ID.'"><a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'#akismet-status" title="' . esc_attr__( 'View comment history' , 'akismet') . '">'.esc_html( $desc ).'</a></span>';

    $show_user_comments_option = get_option( 'akismet_show_user_comments_approved' );
    
    if ( $show_user_comments_option === false ) {
      // Default to active if the user hasn't made a decision.
      $show_user_comments_option = '1';
    }
    
    $show_user_comments = apply_filters( 'akismet_show_user_comments_approved', $show_user_comments_option );
    $show_user_comments = $show_user_comments === 'false' ? false : $show_user_comments; //option used to be saved as 'false' / 'true'
    
    if ( $show_user_comments ) {
      $comment_count = Akismet::get_user_comments_approved( $comment->user_id, $comment->comment_author_email, $comment->comment_author, $comment->comment_author_url );
      $comment_count = intval( $comment_count );
      echo '<span class="akismet-user-comment-count" commentid="'.$comment->comment_ID.'" style="display:none;"><br><span class="akismet-user-comment-counts">'. sprintf( esc_html( _n( '%s approved', '%s approved', $comment_count , 'akismet') ), number_format_i18n( $comment_count ) ) . '</span></span>';
    }

    return $a;
  }
 

 View on GitHub View on Trac

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

Primary Sidebar

Information

Function name: Akismet_Admin::comment_row_action
Class ref: Akismet_Admin
Plugin ref: Akismet
Version: 5.0.1
Sourcefile: class.akismet-admin.php
File ref: class.akismet-admin.php
Deprecated?: No
API Letters: A,C,R

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.27
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