The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Agreement checkbox ...
 
Notifications
Clear all

[Solved] Agreement checkbox default for replies

3 Posts
2 Users
0 Reactions
1,324 Views
wp_user
(@wp_user)
Posts: 4
Active Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#1850]

The js code from this thread works to check the main comment checkbox, in the way I have it hooked in my code below. How do I check all the reply form checkboxes as well?

https://wpdiscuz.com/community/troubleshooting/checkbox-default/

function my_wpdiscuz_autocheck_agreebox() {
    ?>
		<script type="text/javascript"> 
		jQuery('#wpdcom .wpd-field-agreement .wpd-field').prop('checked', true);
		</script>
    <?php
}
add_action('wpdiscuz_comment_form_after', 'my_wpdiscuz_autocheck_agreebox');


 
Posted : 18/03/2021 6:59 pm
Asti
 Asti
(@asti)
Posts: 8260
Illustrious Member Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@wp_user,

Please replace your code with the following one. It should work fine:

function my_wpdiscuz_autocheck_agreebox() {
    ?>
		<script type="text/javascript"> 
		jQuery(document).ready(function(){
			jQuery('#wpdcom .wpd-field-agreement .wpd-field').prop('checked', true);
		});
		jQuery(document).ready(function(){
                        jQuery(document).on('click', '.wpd-reply-button', function() {
                                jQuery('.wpd-form .wpd-field-agreement .wpd-field-group-title .wpd-field').prop('checked', true);
			});
		});
		</script>
    <?php
}
add_action('wpdiscuz_comment_form_after', 'my_wpdiscuz_autocheck_agreebox');

In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.

 
Posted : 19/03/2021 12:46 pm
wp_user
(@wp_user)
Posts: 4
Active Member
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@asti

Thanks for the help! At first the checkbox on the reply comment fields were only showing up after I click the main comment box, but I changed the hook to comment_reply_form_bar_top and that seems to be checking the box for all the forms right away. So I think it's working!


 
Posted : 19/03/2021 8:49 pm