WordPress.org

Ready to get started?Download WordPress

Forums

Hook for allow user as subscriber can edit their comment (1 post)

  1. rambu
    Member
    Posted 1 year ago #

    //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');

Topic Closed

This topic has been closed to new replies.

About this Topic