Welcome to WPSE. The condition you want to prevent is a ID of 0 so only run the query if it does not.
Also, DRY – don’t repeat yourself. Rather than call get_current_user_id()
multiple times, call it once and store it.
$reg_count= 0;
$user_id = get_current_user_id();
if ( 0 !== $user_id ) {
echo "looking for registrations with author id of $user_id"; //PHP will output var value in double quotes
$registrations = new WP_Query(
array(
'posts_per_page' => -1,
'post_type' => "registration",
'author' => $user_id,
'meta_key' => 'first_name',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'event_id',
'compare' => 'LIKE',
'value' => '"' . get_the_id() . '"' //Why not just get_the_id()?
),
),
));
echo "found $registrations->found_posts registrations with author id of $user_id";
}
NOTE: Not at my desk – the code above is untested. Comment here if there is a problem.
EDIT: added missing closing bracket for IF
statement.