I want to allow only registered users to comment on a product page.
However, because of wpDisquz takes into account WooCommerce and it's settings it has different logic.
So either Guests are always able to comment no matter my form settings or no one can comment until they have purchased a product.
The problem is in isUserCanComment function in Form.php. Basically because of WooCommerce the form's restrictions are ignored.
I don't think WooCommerce logic should be there for plain wpDiscuz plugin. Or at least there should be some filters to workaround it.
Please, can you look at it.
Please navigate to Dashboard > Comments > Forms admin page, edit the Default Form and uncheck/disable "Allow Gust Commenting" option for the post type you want. Then delete all caches and do Ctrl+F5 as guest on front-end.
I'm trying to solve the same problem as well. Tom, even when I unchecked the "Allow Guest Commenting" option in the Default Form, it still allows guest comments on Woocommerce products.
It appears the isUserCanComment() function in wpdiscuz/forms/wpdFormAttr/Form.php returns TRUE unless Woocommerce comments are restricted to only those who purchased the product (as rumo indicated above).
Any chance you can fix this in an update?
Hi nick,
I don't know what's wrong on your website, this option works well on all our tested websites. Nothing wrong with isUserCanComment() function. We could check this problem if you send admin login details to support[at]gvectors.com admin page.
Tom, thanks for the response.
I just created a brand new Wordpress install, and installed fresh installs of both WooCommerce and wpDiscuz and am still having the same issue when I disable guest commenting - guests are correctly blocked on normal posts, but aren't blocked on WooCommerce product pages. I've emailed details of the fresh install to the support email address.
Ok, we found the bug. This is already fixed. Please wait for the next wpDiscuz release.
In case you need fix it urgently, you should change in /wpdiscuz/forms/wpdFormAttr/Form.php file (line 738):
if (class_exists('WooCommerce') && get_post_type($post->ID) == 'product')
to this:
if ($user_can_comment && class_exists('WooCommerce') && get_post_type($post->ID) == 'product')