Nothing terribly complicated about this. No modifications to any core or SCE source code either.
Also found out, admin level user has same problem on their own comments, not just others.
Here’s the code:`
// hook into the sce_allow_delete filter, dis-allow users from deleting their comments unless nwf_allow_comment_delete capability is true (capability available on contributor and above)
function nwf_allow_comment_delete($allow_delete)
{
$allow_delete = !$allow_delete ? current_user_can(‘nwf_allow_comment_delete’, true) : $allow_delete;
return $allow_delete;
} // nwf_allow_comment_delete
add_filter( ‘sce_allow_delete’, ‘nwf_allow_comment_delete’, 100);
// hook into sce_unlimited_editing to allow site admin/editor to edit any comment, regardless of how long it’s been up
function nwf_sce_unlimited_comment_edit($allow, $comment)
{
$allow = !$allow ? current_user_can(‘editor’, true) : $allow;
return $allow;
} // nwf_sce_unlimited_comment_edit
add_filter( ‘sce_unlimited_editing’, ‘nwf_sce_unlimited_comment_edit’, 1, 2);
// hook into sce_cookie_bypass to allow site admin/editor to edit any comment, regardless of how long it’s been up
function nwf_sce_can_edit_cookie_bypass($bypass, $comment, $comment_id, $post_id, $user_id )
{
if ( $bypass || current_user_can(‘editor’, true) ) return true;
if ( 0 != $user_id && $comment->user_id == $user_id )
{
$bypass = true;
}
return $bypass;
} // nwf_sce_can_edit_cookie_bypass
add_filter( ‘sce_can_edit_cookie_bypass’, ‘nwf_sce_can_edit_cookie_bypass’, 10, 5);`
-
This reply was modified 5 years, 8 months ago by Brad Mettee.