Title: create a table for specific user
Last modified: August 31, 2016

---

# create a table for specific user

 *  [karimfadl](https://wordpress.org/support/users/karimfadl/)
 * (@karimfadl)
 * [10 years ago](https://wordpress.org/support/topic/create-a-table-for-specific-user/)
 * Hi
 * I have a few users on my own site.
    I want to specify a table for each user ,
   its own shows when he login with his account in the site.
 * Thanks
 * [https://wordpress.org/plugins/custom-database-tables/](https://wordpress.org/plugins/custom-database-tables/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [ka2](https://wordpress.org/support/users/ka2/)
 * (@ka2)
 * [10 years ago](https://wordpress.org/support/topic/create-a-table-for-specific-user/#post-7345779)
 * Thank you for your inquiry.
 * You will be able to allow specific user to any shortcode if you use a “cdbt_after_shortcode_permit”
   filter. The describe of that filter is [here](https://ka2.org/cdbt/v2/filter-reference/cdbt_after_shortcode_permit/)(
   for Japanese only, sorry).
 * For example, if you want to allow access to any shortcode to the only logged 
   in user (ex. user ID is “2”), it is as following:
 * shortcode on the post:
 *     ```
       [cdbt-view table="prefix_table"]
       ```
   
 * added filter:
 *     ```
       function my_after_shortcode_permit( $result_permit, $shortcode_name, $table ){
         if ( 'cdbt-view' === $shortcode_name && 'prefix_table' === $table ) {
           if ( is_user_logged_in() ) {
             $current_user = wp_get_current_user();
             if ( $current_user->ID == 2 ) {
               $result_permit = true;
             } else {
               $result_permit = false;
             }
           }
   
         }
         return $result_permit;
       }
       add_filter( 'cdbt_after_shortcode_permit', 'my_after_shortcode_permit', 10, 3 );
       ```
   
 * Thank you,

Viewing 1 replies (of 1 total)

The topic ‘create a table for specific user’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-database-tables_e4e2e2.svg)
 * [Custom DataBase Tables](https://wordpress.org/plugins/custom-database-tables/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-database-tables/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-database-tables/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-database-tables/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-database-tables/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-database-tables/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [ka2](https://wordpress.org/support/users/ka2/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/create-a-table-for-specific-user/#post-7345779)
 * Status: not resolved