Query custom post the belong to the logged in user

It did not worked for me… the ID of the Card element is #mc_query and this is the code I am using ( I had to add the post name as per some research I have done but still without luck

<?php

add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
  // Replace with your query loop element's ID
  if ( $element_id !== 'mc__query' ) {
    return $query_vars;
  }

  if ( $user_id = get_current_user_id() ) {
    $query_vars['post_type'] = 'compounds';
    $query_vars['author'] = $user_id;
  }

  return $query_vars;
}, 10, 3 );

am I missing something?
Do I need to define $user_id or is it already defined?