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!

Okay
  Public Ticket #1344397
Filter on current user, Serialized PHP array
Closed

Comments

  •  2
    Privattina started the conversation

    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);

  • [deleted] replied

    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  

  •  2
    Privattina replied

    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

  • [deleted] replied

    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.