The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
putting default val...
 
Share:
Notifications
Clear all

putting default value for comments not replies

10 Posts
2 Users
0 Reactions
1,081 Views
Posts: 9
 Roah
Topic starter
(@roah)
Active Member
Joined: 3 years 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: 7617
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 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
Posts: 9
 Roah
Topic starter
(@roah)
Active Member
Joined: 3 years ago

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

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

Illustrious Member
Posts: 7617

@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)
Joined: 3 years 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: 7 years ago

Illustrious Member
Posts: 7617

@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)
Joined: 3 years ago

Active Member
Posts: 9

@asti

It doesn't work 
still require the attachments 😥 

Reply
Asti
Posts: 7617
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 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)
Joined: 3 years 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: 7 years ago

Illustrious Member
Posts: 7617

@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: