Title: shortcode + search current user e-mail
Last modified: October 14, 2019

---

# shortcode + search current user e-mail

 *  Resolved [amatorPL](https://wordpress.org/support/users/amatorpl/)
 * (@amatorpl)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/shortcode-search-current-user-e-mail/)
 * Hi,
 * It’s possible to show messages only sent by current logged user? Something like:
 * [acf7db form_id=’1′ display=’table’ search=’current_user_email’]

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Vsourz Digital](https://wordpress.org/support/users/vsourz1td/)
 * (@vsourz1td)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/shortcode-search-current-user-e-mail/#post-12064671)
 * Hi [@amatorpl](https://wordpress.org/support/users/amatorpl/),
 * This question has already been discussed here:
    [https://wordpress.org/support/topic/show-user-their-own-submission/](https://wordpress.org/support/topic/show-user-their-own-submission/)
 *  Thread Starter [amatorPL](https://wordpress.org/support/users/amatorpl/)
 * (@amatorpl)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/shortcode-search-current-user-e-mail/#post-12064879)
 * Hi [@vsourz1td](https://wordpress.org/support/users/vsourz1td/)
 * I want register it as shotcode and show it somewhere on a page.
 *     ```
       function show_history() {
   
       $user = wp_get_current_user();
       $user_email = $user->user_email;
   
       $show_history = '[acf7db form_id="1174018" search="'.$user_email.'” show="url, price, submit_time"]';
       $history =  do_shortcode($show_history);
   
       return $history;
       }
   
       add_shortcode('show_history', 'show_history'); 
       ```
   
 * This return me all e-mails, not only from current logged user. Where I made mistake?
   Can you help me with that?
 *  Plugin Author [Vsourz Digital](https://wordpress.org/support/users/vsourz1td/)
 * (@vsourz1td)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/shortcode-search-current-user-e-mail/#post-12065076)
 * Please replace below line and check the output once.
    `$show_history = '[acf7db
   form_id="1174018" search="'.$user_email.'" show="url, price, submit_time"]';`
 * If this still not works then i suggest to enter particular email address which
   have any entry. something like this:
    `$show_history = '[acf7db form_id="1174018"
   search="abc@gmail.com" show="url, price, submit_time"]';`
 *  Thread Starter [amatorPL](https://wordpress.org/support/users/amatorpl/)
 * (@amatorpl)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/shortcode-search-current-user-e-mail/#post-12065960)
 * Thank you. Here is working code if anyone need this
 *     ```
       function show_history() {
   
       $user = wp_get_current_user();
       $user_email = $user->user_email;
   
       $show_history = '[acf7db form_id="1174018" search="'.$user_email.'" show="1174018.title, 1174018.url, 1174018.price, 1174018.submit_time" display="table"]';
       $history =  do_shortcode($show_history);
   
       return $history;
       }
   
       add_shortcode('show_history', 'show_history'); 
       ```
   
 * Then we can use [show_history] shortag where we need it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘shortcode + search current user e-mail’ is closed to new replies.

 * ![](https://ps.w.org/advanced-cf7-db/assets/icon-256x256.jpg?rev=1696186)
 * [Advanced Contact form 7 DB](https://wordpress.org/plugins/advanced-cf7-db/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-cf7-db/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-cf7-db/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-cf7-db/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-cf7-db/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-cf7-db/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [amatorPL](https://wordpress.org/support/users/amatorpl/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/shortcode-search-current-user-e-mail/#post-12065960)
 * Status: resolved