Thank you for your inquiry.
Yes, we are able to display data of the logged-in user only. There are several ways, I have example of when to add filter below.
<?php
function custom_select_query( $sql, $table_name, $sql_clauses ){
if ( ! is_admin() && is_user_logged_in() && $table_name === 'sample' ) {
global $cdbt;
$current_user = wp_get_current_user();
$where_clause = "user_id = '". (string) $current_user->ID ."'";
$sql = sprintf( 'SELECT %s FROM %s WHERE %s %s', $sql_clauses[0], $table_name, $where_clause, $sql_clauses[2] );
}
return $sql;
}
add_filter( 'cdbt_crud_get_data_sql', 'custom_select_query', 10, 3 );
Please include the above code in the “functions.php” etc. on the theme. However, it must be stored user ID in the data of the displaying table.
Example of inserting the ID of the user who is logged in at the time of data registration, please try to see below (sorry in Japanese page).
https://ka2.org/cdbt/v2/filter-reference/cdbt_before_insert_data/
Thank you,