Title: Error in Filtering Data
Last modified: July 7, 2019

---

# Error in Filtering Data

 *  Resolved [robenson21](https://wordpress.org/support/users/robenson21/)
 * (@robenson21)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/)
 * Dear TobiasBG.
 * Good day,
 * I’m so sorry I know my question is already answered by other queries, but I totally
   lost. Ok here’s my query.
 * I want also to filter the data in Tablepress like others do but still not work.
   I add this to my functions.php
 * #Code Begin
 * add_shortcode( ‘table-user-filtered’, ‘formfunia_tablepress_filtered_table’ );
   
   function formfunia_tablepress_filtered_table( $atts ) { if ( ! is_user_logged_in()){
   return ‘Error: No user is logged in.’; } $current_user = wp_get_current_user();
   $username = $current_user->user_login; $atts[‘filter’] = $username; $atts[‘cache_table_output’]
   = false; return tablepress_get_table( $atts ); }
 * #End of code
 * Then add the short code in WP Page with this code.
 * [table-user-filtered user_login=2 /]
 * My table ID is 2.
 * I want only to show the data of seedcenter user. Insted of showing only seedcenter
   record they show all records.
 * Can you help me to do that, I mean what is the right shortcode to use to show
   only the seedcenter user. Seedcenter is the current logged in user on my queries.
 * Here’s my table design. Can you check Sir if it’s right design or need to change
   something there?
 * [http://prntscr.com/obn4q9](http://prntscr.com/obn4q9)
 * “Just resend my query because of auto moderation”
 * Best regards,
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ferror-in-filtering-data%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11707622)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Just to be sure: Have you installed and activated the TablePress Row Filter Extension
   from [https://tablepress.org/extensions/row-filter/](https://tablepress.org/extensions/row-filter/)?
   This is mandatory for this to work.
 * Note that this will then use the currently logged-in user for the filtering, 
   and not the Shortcode parameter. If you want to filter for the Shortcode parameter,
   you’d actually not need the extra code, but only the Row Filter Extension.
 * Regards,
    Tobias
 *  Thread Starter [robenson21](https://wordpress.org/support/users/robenson21/)
 * (@robenson21)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11707673)
 * Hi there,
 * Wow it works like a charm… How about filtering using user login name not the 
   user ID.
 * Thank you very much Sir Tobias! =D
 *  Thread Starter [robenson21](https://wordpress.org/support/users/robenson21/)
 * (@robenson21)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11707689)
 * Hi Sir Tobias,
 * I got it! Thank you very much!
 * Cheer’s! =D
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11707733)
 * Hi,
 * no problem, you are very welcome! 🙂 Good to hear that this helped!
 * Best wishes,
    Tobias
 * P.S.: In case you haven’t, please [rate TablePress](https://wordpress.org/support/plugin/tablepress/reviews/)
   here in the plugin directory. Thanks!
 *  Thread Starter [robenson21](https://wordpress.org/support/users/robenson21/)
 * (@robenson21)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11708269)
 * Hi,
 * Yes sure, Thank’s
 * Cheer’s! =D
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11708371)
 * Hi,
 * thanks!
 * Best wishes,
    Tobias
 *  Thread Starter [robenson21](https://wordpress.org/support/users/robenson21/)
 * (@robenson21)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11836853)
 * Hi Sir Tobias,
 * Good day,
 * Out of the topic question, maybe you can help me, this is a shortcode problem
   from my part.
 * I want to show the current data in my wordpress page using a shortcode. The database
   name is loan_db, inside is the loan_tbl table, with one column containing their
   user id to enable the filter to show only the record of current logged in user.
   Can you help me Sir to do that?
 * Thank you….
 * Best,
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [6 years, 10 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11837430)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Sorry, I can not really help with that. TablePress does not have a feature to
   connect to a real database table. Your best chance here probably is a custom 
   solution using a Shortcode that internally does a WP_Query to select the desired
   data from the database.
 * Regards,
    Tobias

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

The topic ‘Error in Filtering Data’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

## Tags

 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [sorting](https://wordpress.org/support/topic-tag/sorting/)

 * 8 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [6 years, 10 months ago](https://wordpress.org/support/topic/error-in-filtering-data/#post-11837430)
 * Status: resolved