Created
October 17, 2012 09:02
-
-
Save rambuvn/3904593 to your computer and use it in GitHub Desktop.
my hook, allow all user can edit comment ( subscriber )
This file contains hidden or 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
//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