Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions connectors/comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,15 @@ public static function callback_wp_insert_comment( $comment_id, $comment ) {
$post_type = get_post_type( $post_id );
$post_title = ( $post = get_post( $post_id ) ) ? "\"$post->post_title\"" : __( 'a post', 'stream' );
$comment_status = ( 1 == $comment->comment_approved ) ? __( 'approved automatically', 'stream' ) : __( 'pending approval', 'stream' );
$is_spam = false;
// Auto-marked spam comments
if ( class_exists( 'Akismet' ) && Akismet::matches_last_comment( $comment ) ) {
$ak_last_comment = Akismet::get_last_comment();
if ( 'true' == $ak_last_comment['akismet_result'] ) {
$is_spam = true;
$comment_status = __( 'automatically marked as spam by Akismet', 'stream' );
}
}
$comment_type = mb_strtolower( self::get_comment_type_label( $comment_id ) );

if ( $comment->comment_parent ) {
Expand All @@ -249,9 +258,9 @@ public static function callback_wp_insert_comment( $comment_id, $comment ) {
'1: Comment author, 2: Post title 3: Comment status, 4: Comment type',
'stream'
),
compact( 'user_name', 'post_title', 'comment_status', 'comment_type', 'post_id' ),
compact( 'user_name', 'post_title', 'comment_status', 'comment_type', 'post_id', 'is_spam' ),
$comment_id,
array( $post_type => 'created' ),
array( $post_type => $is_spam ? 'spammed' : 'created' ),
$user_id
);
}
Expand Down