Notifications
Clear all

[Solved] How to make 'pending' status for only comments with media?

5 Posts
2 Users
0 Reactions
507 Views
Posts: 2
Topic starter
(@kinganozynska)
New Member
Joined: 9 months ago

Hello, 

How to set comments with attachments to always be checked (Status: Pending)? Others comment without media are added without checking.

I would be very grateful for help

Have a nice day!

4 Replies
Astghik
Posts: 6152
Admin
(@astgh)
Illustrious Member
Joined: 7 years ago

Hi,

wpDiscuz does not include a moderation feature. Instead, it uses the native WordPress moderation option, accessible on the WordPress Dashboard > Settings > Discussion tab. Therefore, moderation is managed on the WordPress side rather than through wpDiscuz. 

Posts: 2
Topic starter
(@kinganozynska)
New Member
Joined: 9 months ago

Hello,
Thank you for your response.

As I thought it would only be wordpress related but I had to make sure.

Can you give me a hint or maybe know some solution to extend the default wordpress comment moderation?

I'm only interested in including the condition 'if there is an attachment to the comment, it should be in pending status'.

I will be grateful for your help.

Have a nice day

2 Replies
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6152

@kinganozynska,

Please use the hook-code below: 

add_action( 'comment_post', function ( $comment_ID ) {
	if ( $comment_ID && ! empty( $_POST["wmu_attachments"] ) ) {
		$comment = get_comment( $comment_ID );

		if ( ! ( $comment instanceof WP_Comment ) ) {
			return;
		}

		if ( $comment->comment_approved != 0 ) {
			wp_update_comment( [
				'comment_ID'       => $comment_ID,
				'comment_approved' => 0,
			] );
		}
	}
}, 100 );

 Put the code in the active theme functions.php file. 

 This artcile should be helpful for you: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6152

We have not received a reply from you for over a couple of weeks, therefore we will be closing this topic. Please create a new one if you require any additional help.

Thank You!

Share:
Scroll to top