Improving a Stackoverflow “inspired” badge system to display badges in author page

get_current_user_id(); gets the current logged in user id and you need the user whos profileUrl is views so try this insted to get the right id:

$author = get_user_by( 'slug', get_query_var( 'author_name' ) ); 
echo $author->ID;'

yep, so instead of your code try this:

$author = get_user_by( 'slug', get_query_var( 'author_name' ) ); 
if ($author->ID > 0) {
  rhb_list_badges(array('user_ID' => $author->ID));
}

tech