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
Will I be able to filter posts on currently logged in user if I build my custom wp_query and call it as a "Serialized PHP array".
I have been reading the forum and it looks get_current_user_id is not available when wpDataTables calls the file?
I have this, will it work?:
$return_array = array();
$filtered_posts = get_view_query_results(18635);
foreach ($filtered_posts as $filtered_post) {
$post_author = get_post_field('post_author', $filtered_post->ID);
if (get_current_user_id() == $post_author) {
$return_array[] = array(
//multiple 'label' => get_post_meta(),
);
}
}
echo serialize($return_array);
Hi Privattina,
Thank you for your inquire.
i really would like to help you but this is more of the question for creator of the function that you intent to use then for us. If you can write your code in a way that it will return desirable data in format that is described in our Documentation I am sure that it will work in our plugin. If it doesn't please feel free to open a ticket in corresponding section of this support and one of our agents will help you with the issue
Maybe I wasn't clear in my question. I have no problem with creating the function. My question is if I will be able to filter on current user. I have read in the forum threads that indicate that "current user" is not available if you create a table from a wp_query.
I tried to post as a support ticket but I was not allowed.
In my test current user returns 0
Hi Privattina,
If I understood you correctly you try to find a way to filter the table by user?
If this is the case you have an option to prefilter the table by entering “Predefined values” and there you can use placeholder %CURRENT_USER_ID% to filter the table by user ID.