• Resolved Gilabert

    (@gilabert)


    Hello guys,
    I need to make dynamic table by filering record with the current user ID logged in wordpress. In the configuration panel of the wpDataTables plugin the SQL Request made with placeholders :
    ———————————————–
    SELECT mt_process.process_refid,
    mt_process.step1_contract_init,
    mt_process.cl_companie,
    mt_process.cl_id,
    mt_process.cl_last_name,
    mt_process.cl_first_name,
    mt_process.cl_surname,
    mt_process.fr_surname,
    mt_process.fr_id
    FROM mt_process
    WHERE mt_process.fr_id=%CURRENT_USER_ID%
    ——————————————————————–
    Everytime I’ve got the ERROR message below (translated from french) when I want to apply it.
    ERROR MESSAGE
    >>No data extracted!
    >>If you are trying to save the table for the first time, please enter a date before >>saving so that the table can be defined precisely.
    >>You can delete it later if you need an empty board to start.
    >>Request output: SELECT mt_process.process_refid, mt_process.step1_contract_init, >>mt_process.cl_companie, mt_process.cl_id, mt_process.cl_last_name, >>mt_process.cl_first_name, mt_process.cl_surname, mt_process.fr_surname, >>mt_process.fr_id FROM mt_process WHERE mt_process.fr_id = 2 LIMIT 10
    I don’t understand at all which date I need to set up and where ? I’ve spent hours in the documentation and also in many forums but I didn’t see anything relevant.
    WordPress Configuration :
    WordPress Version : 5.2.3–fr_FR,
    wpDataTable Version : 2.6.1
    PHP Version : 7.3
    Thanks for your support.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author wpDataTables

    (@wpdatatables)

    Hi there.

    You don’t need the database name in the query, since you’re pulling all these columns from one table.

    So, you can try with this:
    _________________________________________________
    SELECT process_refid,
    step1_contract_init,
    cl_companie,
    cl_id,
    cl_last_name,
    cl_first_name,
    cl_surname,
    fr_surname,
    fr_id
    FROM mt_process
    WHERE fr_id=%CURRENT_USER_ID%
    _________________________________________________

    And that should work just fine.

    Best regards.

    Thread Starter Gilabert

    (@gilabert)

    it’s the same issue with the SQL request you suggest. However I’ve finally found the root cause of the problem. In fact when you set up a new table you are logged with WordPress admin account and %CURRENT_USER_ID% value is the ID of the admin user. Unfortunately there is no record in the SQL table with admin ID because SQL data are the inventory of clients. To solve it I’ve just added a dummy record with the admin ID and it works. you may save and apply setting of the new table and then afterward you’ve to erase the dummy record with admin ID. May be you should take into account this issue for next releases and change the ERROR message in French which is no relevant at all. It’s not a matter to add any date somewhere as mentioned in the text.

    Thanks for your support and your responsiveness,

    • This reply was modified 5 years, 2 months ago by Gilabert.
    Plugin Author wpDataTables

    (@wpdatatables)

    Hi again.

    Thank you for your reply.

    Yes, the other issue there would be that the user ID is missing from the table. It is a dynamic response when a table returns zero results.

    It will be forwarded to our development team, so they can look into it.

    Best regards.

    uebes

    (@uebes)

    Hello guys,

    I use the full version of wpdatatable.

    I synchronize a table with a Google spreadsheet with different data from 50 WordPress users. This works fine. I can change a cell in the Google spreadsheet and I can see this on my wpdatatable. But I‘d like to see only the data from the logged in ID of current WordPress user. Is there any possibility to arrange this?

    Best regards
    Siegfried

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error with placholders %CURRENT_USER_ID%’ is closed to new replies.