(solved) getting post author’s user role

You can find the author’s ID on the post and fetch their user object from that with get_userdata(), e.g.

$author = get_userdata( get_post()->post_author ) ;
if ( !in_array( 'administrator', (array) $author->roles ) ) { ... }

error code: 523