How to hide wordpress post comment form for specific role

You can hook to the comments_open filter.

add_filter('comments_open', function($open, $post_id){
  if(in_array( 'author', (array) wp_get_current_user()->roles){
    return false;
  }
  return $open;
}, 10, 2);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)