wpDiscuz - WordPress Comment Plugin
Share:
Notifications
Clear all

putting default value for comments not replies


Roah
Posts: 9
 Roah
Topic starter
(@roah)
Active Member
Joined: 5 months ago

Hello 
I want to put a default value to comments,  just for comments not replies

and not placeholder 

it's a value 

can you help me please?

9 Replies
Asti
Posts: 3567
 Asti
Support
(@asti)
Support member
Joined: 4 years ago

Hi @roah,

I'm really sorry, but there isn't an easy solution we can provide you. You should write custom JS codes for this kind of customization. 

Reply
Roah
Posts: 9
 Roah
Topic starter
(@roah)
Active Member
Joined: 5 months ago

can help me to make attachments as "required" just in my comments ???

Reply
4 Replies
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3567

@roah,

Use this JS code:

jQuery(document).ready(function ($) {
$(document).on('click', '.wc_comm_submit', function (e) {
if (!($(this).parents('.wpd_comm_form').find('.wmu-attachments-ids') && $(this).parents('.wpd_comm_form').find('.wmu-attachments-ids').val())) {
wpdiscuzAjaxObj.setCommentMessage('Attachment is required');
e.preventDefault();
e.stopImmediatePropagation();
return false;
}
});
});

Just make sure this JS code is being loaded before the wpDiscuz js files. 

Reply
Roah
 Roah
(@roah)
Joined: 5 months ago

Active Member
Posts: 9

@asti

please can you update this code to make required attachments just for comments not replies?
I tried to put (.wpd-main-form-wrapper) as a parent class but that didn't work 

thank you very much

Reply
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3567

@roah,

Try this one:

jQuery(document).ready(function ($) {
  $(document).on('click', '.wc_comm_submit', function (e) {
    if (!($(this).parents('.wpd_main_comm_form').find('.wmu-attachments-ids') && $(this).parents('.wpd_main_comm_form').find('.wmu-attachments-ids').val())) {
      wpdiscuzAjaxObj.setCommentMessage('Attachment is required');
      e.preventDefault();
      e.stopImmediatePropagation();
      return false;
    }
  });
});
Reply
Roah
 Roah
(@roah)
Joined: 5 months ago

Active Member
Posts: 9

@asti

It doesn't work 
still require the attachments 😥 

Reply
Asti
Posts: 3567
 Asti
Support
(@asti)
Support member
Joined: 4 years ago
Posted by: @asti

Just make sure this JS code is being loaded before the wpDiscuz js files. 

What about this condition? Are you sure this is made? 

Reply
2 Replies
Roah
 Roah
(@roah)
Joined: 5 months ago

Active Member
Posts: 9

@asti

how exactly can I do that ?

I put this code in child theme and in Header and Footer manager Code plugin and Still doesn't work

Reply
Asti
 Asti
Support
(@asti)
Joined: 4 years ago

Support member
Posts: 3567

@roah,

You can create some new JS file, put the code in the file, then add the created file in the header of your active theme. If it still doesn't work, keep the changes and leave some example URL to allow us to check the issue. 

Reply
Share: