Created
June 28, 2011 22:24
-
-
Save scribu/1052398 to your computer and use it in GitHub Desktop.
Restrict comment editing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// http://scribu.net/wordpress/prevent-blog-authors-from-editing-comments.html | |
function restrict_comment_editing( $caps, $cap, $user_id, $args ) { | |
if ( 'edit_comment' == $cap ) { | |
$comment = get_comment( $args[0] ); | |
if ( $comment->user_id != $user_id ) | |
$caps[] = 'moderate_comments'; | |
} | |
return $caps; | |
} | |
add_filter( 'map_meta_cap', 'restrict_comment_editing', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment