get_the_author_meta() not returning correct id on buddypress profile page


I am trying to display the events that a user has submitted on their buddypress profile. The following code works when I fix the user id at a specific number e.g. $user_id = 14 but not when I try and dynamically find the buddypress user id of the profile being displayed:

function custom_shortcode(){
             $user_id = get_the_author_meta( 'ID' ); //returns id of user profile
             return do_shortcode( '[eo_events author='.$user_id.']' ); }
add_shortcode( 'eo_custom_shortcode', 'custom_shortcode' );

So the problem must be with get_the_author_meta('ID') but I can't find what. I have inserted the above code in functions.php. I then am using the shortcode in profile-loop.php as follows:

/** This action is documented in bp-templates/bp-legacy/buddypress/members/single/profile/profile-wp.php */
do_action( 'bp_after_profile_loop_content' ); ?>
<h5 class="event_profile_title_random"> Upcoming Events & Deadlines... </h5>
<div id="event_profileinfo_random">  [eo_custom_shortcode] </div>

What is going wrong? I guess I'm using get_the_author_meta() wrong but I have no idea how...