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

Limited Support

Our support team is currently on holiday from December 25, 2025 to January 7, 2026, and replies may be delayed during this period.

We appreciate your patience and understanding while our team is away. Thank you for being part of the wpDiscuz community!

Merry Christmas and Happy Holidays! πŸŽ„

Question [Solved] Reply comments

5 Posts
2 Users
0 Reactions
1,054 Views
Posts: 2
Topic starter
(@jon62)
New Member
Joined: 3 years ago

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

@jon62,

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.Β Β 


Posts: 2
Topic starter
(@jon62)
New Member
Joined: 3 years ago

Hi !Β 

Thank you for your feedback, where to place the code please

2 Replies
Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8203

@jon62,

In the active theme functions.php file.Β 

This article should be helpful for you: https://themeisle.com/blog/php-in-wordpress/


Asti
 Asti
Support
(@asti)
Joined: 8 years ago

Illustrious Member
Posts: 8203

We have not received a reply from you for over a couple of weeks, therefore we will be closing this topic. Please create a new one if you require any additional help.

Thank You!


Share: