displaying custom code on a given users profile page

Assuming you are in the back-end (admin), so the user profile page is being rendered by /wp-admin/user-edit.php – there is a global variable that indicates the id of the user whose profile we are on. If you look at the source code for user-edit.php you can see it guarantees (or will die) the existence of the variable $user_id which contains the ID, and will get it from the global object $current_user, if we have a logged-in user.

You could hook this to WP user-edit.php :

function calendar_info( $some_user ) { 
    // we can do something with the $some_user object or we can ignore it...
    global $user_id;   // user id of the profile currently being displayed/edited
       echo get_calendar_data( $user_id );
}
add_action('show_user_profile', 'calendar_info');  // only fires when viewing currently logged-in user's profile page
add_action('edit_user_profile', 'calendar_info');  // only fires when viewing another user's profile page

Those hooks pass in the currently logged-in user object

You need to hook to both of these actions due to the logic of when each of them fires (logged-in user profile versus viewing another user’s profile).

Of course you could have a different function hooked to each action – say for example if you wanted to show something different for a logged-in user viewing their own profile versus viewing another user’s profile.

The only thing not too nice about these hooks is that they fire near the bottom of the profile page, not the top.