Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.
Feb 06, 2023 9:58 pm
Hi !Â
I want to use WPDISCUZ as customer reviews. For that I would like that only, the administrator of the site or a user in particular, can answer the comments of the customers how to make please?
4 Replies
Feb 08, 2023 9:24 am
Use the hook code below:Â
add_filter('wpdiscuz_comment_list_args',function($args){ $current_user = wp_get_current_user(); $current_user_roles = (array)$current_user->roles; if($args['can_user_reply'] && !in_array('administrator', $current_user_roles)){ if(!in_array('role_name', $current_user_roles)){ $args['can_user_reply'] = false; } } return $args; }); add_filter('preprocess_comment', function($commentdata){ $current_user = wp_get_current_user(); $current_user_roles = (array)$current_user->roles; if($commentdata['comment_parent'] && !in_array('administrator', $current_user_roles)){ if(!in_array('role_name', $current_user_roles)){ wp_die('You don\'t have permission to comment.'); } } return $commentdata; });
For administrators, the code works fine.Â
You should change the red marked value for the particular user role who should be able to reply. Â
Feb 09, 2023 12:26 pm
Hi !Â
Thank you for your feedback, where to place the code please