PluginProbe
Patchstack – WordPress & Plugins Security / 2.2.11
Patchstack – WordPress & Plugins Security v2.2.11
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | includes/events/comments.php +13 -10 2.1.62.2.11 View file →
@@ -15,17 +15,20 @@
15 15 *
16 16 * @return void
17 17 */
18 18 public function __construct() {
19 - add_action( 'wp_insert_comment', array( &$this, 'handleCommentLog' ), 10, 2 );
20 - add_action( 'edit_comment', array( &$this, 'handleCommentLog' ) );
21 - add_action( 'trash_comment', array( &$this, 'handleCommentLog' ) );
22 - add_action( 'untrash_comment', array( &$this, 'handleCommentLog' ) );
23 - add_action( 'spam_comment', array( &$this, 'handleCommentLog' ) );
24 - add_action( 'unspam_comment', array( &$this, 'handleCommentLog' ) );
25 - add_action( 'delete_comment', array( &$this, 'handleCommentLog' ) );
26 - add_action( 'transition_comment_status', array( &$this, 'transitionCommentStatus' ), 10, 3 );
19 + if ( ! get_option( 'patchstack_activity_log_comments', 0 ) ) {
20 + return;
21 + }
27 22
23 + add_action( 'wp_insert_comment', [ &$this, 'handleCommentLog' ], 10, 2 );
24 + add_action( 'edit_comment', [ &$this, 'handleCommentLog' ] );
25 + add_action( 'trash_comment', [ &$this, 'handleCommentLog' ] );
26 + add_action( 'untrash_comment', [ &$this, 'handleCommentLog' ] );
27 + add_action( 'spam_comment', [ &$this, 'handleCommentLog' ] );
28 + add_action( 'unspam_comment', [ &$this, 'handleCommentLog' ] );
29 + add_action( 'delete_comment', [ &$this, 'handleCommentLog' ] );
30 + add_action( 'transition_comment_status', [ &$this, 'transitionCommentStatus' ], 10, 3 );
28 31 }
29 32
30 33 /**
31 34 * Log the action regarding the comment.
@@ -40,14 +43,14 @@
40 43 $comment = get_comment( $id );
41 44 }
42 45
43 46 $this->insert(
44 - array(
47 + [
45 48 'action' => $action,
46 49 'object' => 'comment',
47 50 'object_id' => $id,
48 51 'object_name' => esc_html( get_the_title( $comment->comment_post_ID ) ),
49 - )
52 + ]
50 53 );
51 54 }
52 55
53 56 /**