Notifications
Clear all

Some other roles can moderate whereas it should not be possible

19 Posts
2 Users
0 Reactions
2,096 Views
Posts: 10
Customer
Topic starter
(@eric-welment)
Member
Joined: 3 years ago

Ok. Can you please provide a snippet so that moderation is linked to admin+editor roles and not to a specific capability.

Thanks in advance

Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6149

@eric-welment,

Please deactivate the plugin and check again. If the issue is caused by the plugin just contact the plugin support and ask them to solve the issue. 

Reply
Posts: 10
Customer
Topic starter
(@eric-welment)
Member
Joined: 3 years ago

the problem is not the plugin, the problem is your plugin moderation is linked to a capability shared by several roles, it is not linked to roles. Can you tell me the capability you use ?

Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6149

Hi, sure, here are those:

  • moderate_comments
  • edit_comment
Reply
Posts: 10
Customer
Topic starter
(@eric-welment)
Member
Joined: 3 years ago

Hi, I am sorry but I removed these capabilities but "inscrits" can still moderate comments

I put this in functions.php (child theme)

// remove inscrits capabilities

function remove_inscrits_moderate_comments(){
global $wp_roles;
$wp_roles->remove_cap( 'inscrits', 'moderate_comments' );
}

function remove_inscrits_edit_comment(){
global $wp_roles;
$wp_roles->remove_cap( 'inscrits', 'edit_comment' );
}

Can you please help solve this issue.

Regards

Eric

Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6149

@eric-welment,

Have you called those functions before the wpDiscuz functions are being called?  

Reply
Posts: 10
Customer
Topic starter
(@eric-welment)
Member
Joined: 3 years ago

I put them in my functions.php

Reply
1 Reply
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6149

It's not enough to add the functions. You should also call the functions you've added while the WordPress init hook is working. More info here: https://developer.wordpress.org/reference/hooks/init/

Reply
Posts: 10
Customer
Topic starter
(@eric-welment)
Member
Joined: 3 years ago

Ok, I will try that and see how it goes

Anyway I found a fix : I edited the php file to modify capabilities conditions to 'moderate_comments AND edit_comment' instead of OR

Best regards

Reply
Page 2 / 2
Share:
Scroll to top