As previously announced via banners and our newsletters, support is no longer available through this platform.
For easier navigation, you can still click on "Submit a Ticket" here, choose the appropriate category, and you'll be redirected to the correct support channel for your plugin.
You can still access your previous tickets and browse public tickets, but please note that responding to tickets is no longer possible.
Paid customers: Please log in to your store account for support.
Pre-purchase questions: Use the support widget in the bottom-right corner of our websites:
https://wpamelia.com
https://wpdatatables.com
https://wpreportbuilder.com
Can we use a logged in user profile variable to populate wpdatatable variable:
So we currently have a code like this:
[wpdatatable id=2 var1=AC]
Where we would need a separate code filter for each user - this is the code we use to auto insert this info into a gravity form: {user:lab_code}
So I tried using this filter code:
[wpdatatable id=2 var1={user:lab_code}]
But this returns no results to the logged in user.
Can this be done?
I figured it out for all those who might need this - used a php code snippet tool (shortcode):
<?php if ( is_user_logged_in() ) { ?>
<!-- text that logged in users will see -->
<?php global $current_user; get_currentuserinfo(); ?>
<?php echo do_shortcode("[wpdatatable id=2 var1=\"$current_user->lab_code\"]"); ?>
<?php } else { ?>
<!-- here is a paragraph that is shown to anyone not logged in -->
<p>By <a href="<?php bloginfo('url'); ?>/wp-register.php">registering</a>, you can save your favorite posts for future reference.</p>
<?php } ?>
Hi, Patrick
My sincere apologies, i have somehow misread the beginning of your ticket and it seemed that you mentioned tables linked to Gravity Forms, so i sent a reply about that, you got an Email with this reply.
-
I have deleted it here, and it seems i did not correctly understand your use-case,
but i will elaborate about generally prefiltering tables per logged in user.
If i understood your use-case correctly, your goal is to predefine a filter that will only show rows associated with the currently logged user?
-
There can be different ways to achieve predefined filters for our tables by currently logged user.
-
You can use placeholders for table generation.
1. For example, if you have a MySQL query-based table, and if you have a column that stores user's logins,
you can use this query:
%VAR1% can be defined in the Placeholders tab when you're creating a table,
then you can have multiple SQL Query-based tables that each have a different value filtered of that column.
2.
Or, you can use a predefined placeholder as filtering value in a Column's settings.
If you have a column that stores currently logged user values,
you can set filter type as Text, and use predefined filter value as %CURRENT_USER_LOGIN% :
-
But, i am not sure i understood your use-case, it seems it might be more complex than this if you need to pass this as a VAR in the shortcode,
and i don't know which table type you are using, as well.
Could you elaborate a bit more about this use-case?
Thank you
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables