in my comments I wanna show different avatars depending on the user role that the person has, that was giving upto the comment (not the role of the logged in user).
I tried like it follows inside comments loop:
<?php
$commentator_id = get_comment(get_comment_ID())->user_id;
$commentator_info = get_userdata($commentator_id);
$capabilities = $user_info->wp_capabilities;
if (array_key_exists('editor', $capabilities)) {
// echo markup here
}
?>
But it doesn't function. Does anybody know why ?