The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Please make comment...
 
Share:
Notifications
Clear all

[Solved] Please make comment field not required

12 Posts
2 Users
1 Reactions
1,367 Views
Posts: 15
 Jave
Topic starter
(@jave)
Eminent Member
Joined: 3 years ago

Hello,

 

i know it's not possible at the moment to make the comment field not required (like with no input of the user) so i'm asking you to please consider to make this happen in the next update. 

 

I see it's already been asked often in this forum - it would be a great improvement espacially when using wpdiscuz mainly for the comment rating function like I do.

if someone knows a workaround for now please let me know.

Anyway I found this javascript approach: https://salferrarello.com/wordpress-allow-empty-comment/

 

but i don't know if this would be possible with your plugin too?

 

11 Replies
Asti
Posts: 7661
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 years ago

Dear Jave,

This is already in our to-do list. We'll implement it in the feature version. 

However, this requires large changes in the plugin codes and it won't be implemented in near future versions. 

Posts: 15
 Jave
Topic starter
(@jave)
Eminent Member
Joined: 3 years ago

Ok that's good to know! But could the above javascript work if its gets customized to the wp discuz form fields as a transitional solution? 

9 Replies
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7661

@jave,

Not sure if there is an easy way for this kind of customization. 

Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7661

Dear @jave,

The new version already has this feature. Now you can use the "allow_empty_comment" hook. Besides adding the hook, you should also change the following options as well:

  • Comment Text Length
  • Reply Text Length

The values of those fields should be set to 0.

 Jave
(@jave)
Joined: 3 years ago

Eminent Member
Posts: 15

@asti Great news, works like a charm! 

Now i just wonder if it's possible to not show the comments on the frontend which contain empty comment and just register the ratings?

anyway, great update

Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7661

@jave,

Please show on some screenshots what you mean. Also, leave the example URL as well. 

 Jave
(@jave)
Joined: 3 years ago

Eminent Member
Posts: 15

@asti Don't really have screenshots or example url.

My thought are like if the user decides just to rate and leaves the comment box empty then this comment shouldn't be shown in the comment box below the article. It should just be counted into the rating. right now it gets added as a normal comment but without content (only name and rating).

I know it's possiblie with article rating to rate without comment but as I'm using several rating options i am relying on the comment rating feature.

It's not that important tho but maybe there is a simple solution i cant think of right now.

Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7661

@jave,

We'll check and let you know if there is a solution we can provide you. 

Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7661

@jave,

Please follow the steps below: 

1. Put the code below in the WordPress active theme functions.php file:

add_filter('comment_class',function($classes, $css_class, $comment_ID, $comment){
    if($comment->comment_content == ''){
        $classes[] = 'empty-comment';
    }
    return $classes;
},15,4);

The code adds the empty-comment class to each comment without any content. 

BTW: you can change the empty-comment class name as you like. 

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

2. Hide the div with empty-comment class using this CSS code: 

#wpdcom .empty-comment {
    display: none;
}

Put the code in the Top Admin Bar > Customize > Additional CSS > "Additional CSS" textarea, save it, delete all caches and check again.

3. Another point you can use the hook code below if you face the issue with the duplicate comment:

add_filter('duplicate_comment_id', '__return_false');

It also should be added in WordPress active theme functions.php file. 

 Jave
(@jave)
Joined: 3 years ago

Eminent Member
Posts: 15

@asti wow thank you! The last hook i don't quite get - what and when is this issue happening? Couldn't notice a duplicate comment issue with my site yet but should i use it anyway?

Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7661

@jave,

Couldn't notice a duplicate comment issue with my site yet but should i use it anyway?

Try to post twice a comment without any content and if you see the duplicate comment issue, then add the code, otherwise don't add it. 

Share: