Skip to content

Instantly share code, notes, and snippets.

@rambuvn
Created October 17, 2012 09:02
Show Gist options
  • Save rambuvn/3904593 to your computer and use it in GitHub Desktop.
Save rambuvn/3904593 to your computer and use it in GitHub Desktop.
my hook, allow all user can edit comment ( subscriber )
//Trick allow user subscriber can edit comment
function nex_update_cap($allcaps){
//print_r($allcaps);
global $comment;
if( !empty($comment) ){
global $current_user;
if( $current_user->ID == $comment->user_id ){
$allcaps['edit_others_posts'] = 1;
$allcaps['edit_published_posts'] = 1;
}
}
return $allcaps;
}
add_filter('user_has_cap', 'nex_update_cap');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment