My site runs WpDiscuz and WpDiscuz private comments. I will be using it on a few pages across my site but there is 1 page where I need the comments to always be private. So I understand I can create various forms but I don't see the option to always make the comment private on that particular form or page. What would be the best way to go about it? Maybe a code snippet you can provide?
Thank you for your reply. It does work indeed for my form 2 but what if I want my form 1 to be allowed to pick private or public but not be automatically private ?
Say that for form 1 I want to "Enable private threads for comment forms" but I don't want to "set new comments pivate"
But on my form 2 I want to "Enable private threads for comment forms" and "set new comments pivate".
See the problem is that the "Set new comment to private" cannot be applied to only 1 form.
1. Disable the "Set new comments to private" option.
2. Add the following code in the active theme's functions.php file:
add_action('wpdiscuz_front_scripts', function () { global $post; $wpdiscuz = wpDiscuz(); $form = $wpdiscuz->wpdiscuzForm->getForm($post->ID); if ($form->getFormID() == X) { wp_enqueue_script('wpdiscuz-private-comments-set-private-by-default', get_stylesheet_directory_uri() . '/assets/js/wpdiscuz-private-comments-set-private-by-default.js', array('jquery')); } });
The value X code should be change. Please set the Form ID you've created for the special (there all comments must be private) post/page instead of it.
On the screenshot below I've shown how to get the Form ID:
3. Add the wpdiscuz-private-comments-set-private-by-default_js.js file into /wp-content/plugins/wpdiscuz-private-comments/assets/js folder. The file can be found in the zip folder below:
4. Edit the Form you've created, and fill the current post/pages IDs in the "Display comment form for post IDs" section.
First of all please uncheck the page post type. As you've filled the page D it's not necessary to check the post type.
3. Add the wpdiscuz-private-comments-set-private-by-default_js.js file into /wp-content/plugins/wpdiscuz-private-comments/assets/js folder. The file can be found in the zip folder below:
Sorry, I gave you the wrong path. The js file should be added in the active theme /assets/js/ folder.