We're Moving to a New Support Platform – Starting June 1st!
We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.
You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.
While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.
We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.
Thanks for your continued support and trust – we’re excited to bring you an even better support experience!
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