Okay
  Public Ticket #3067094
Showing one entry in a table/chart for a user
Closed

Comments

  • Theo started the conversation

    Hi

    I went through the documentation and sandbox but I couldnt work out if wpdatatables would work for my user case?

    I have a gravity form which allows users to submit an entry on "How are you feeling today".

    I understand the entries can get stored in a table.

    Is it possible for a user to view their SINGLE submission in a table - and therefore a chart?

    Being specific, I want to a user to be able to see how they are feeling in a single specific entry, and also a table of all their previous entries.

    (Perhaps too specific, but my first thoughts I was hoping that I could send a variable in the URL parameter, and for wpdatatables to be able to display the relevant submission in a table/chart).

  •  1,689
    Miloš replied




    Hi, Theo

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    There is a way to prefilter the data in a table by using placholders such as current user ID, username, email etc.

    You can check the list of all placeholders available here.

    This might be very tricky to achieve, to only present a single entry.

    I have an idea, but haven't tested it yet.  For example, maybe if you have a field in the Gravity form ( not sure if they have this feature), that can automatically store the current date of the entry when the user submits it.

    Then maybe we could be able to at least filter by today's date.  If the user would only submit this daily, which seems logical if the question would be "how are they feeling today".

    If you have a field to hold the date, you could make a wpDataTable linked to the Form, that will filter only entries from today.

    %CURRENT_DATE% – this placeholder will be replaced with the current date.

    9700861752.pngIf we create predefined value for the filter of this column that holds the date of the entry;

    set filter type as Text, and value %CURRENT_DATE%, i am not 100% sure, but just an idea of a workaround.

    Perhaps it could work to filter today's date only, for that purpose.

    So, for presenting only that single row  of data might be very tricky to achieve.

    -

    But regarding prefiltering the data only for specific user, to show all their entries, that we can do.

    I will show you an example.

    - First, you would have to add a field that will store the user ID. 

    We will add a predefined filter value to it, using a Place Holder "Current User ID";

    - Check that the filter type is set as "Text", as shown on this screenshot.

    8249361981.png

    - Here is how an example table linked to a source looks before we make any changes, with visible filters above the table.

    7932387639.png

    And now, when we set the pre-filter, with Administrator logged in ( In our case, the user ID is 1), we only see rows matching that user ID.

    3633379684.png

    - (If you need more detailed information about using Place Holders in wpDataTables, here is our documentation about that https://wpdatatables.com/documentation/table-features/using-placeholders/);

    - The user_ID filter is still visible, which means, if someone changes/deletes this value, they could see the whole table.

    We will hide it from the front-end with some custom CSS added in the "Customize" section of the main table settings.

    - It should be easy to do, depending on your knowledge of HTML and CSS.

    You have to find the correct selector using the browser inspector tool, add the style "display:none" property to it, and it will disappear from the front-end.

    On our example table, the custom CSS is :

    #table_1_5_filter_sections  {
        display:none; }
    5537273103.png

    - Now, the user_ID filter is gone from the front-end.

    8120839900.png

    - Optionally, you can hide the user_id column from the front-end, if needed, either using the column settings tab or the "column list" button from the back-end Admin area.

    1618300341.png

    Or if you wish to show the user ID column, but to only hide the filter  ( to prevent user from clearing the filter, and seeing other users fields) , we can add some custom CSS - you can let me know if you need that.

    -

    Regarding prefiltering through URL, please check out this documentation.

    - Let me know how all this sounds, and If you have any questions. Thank you

    -


    And, just wanted to point out that we have a Demo Sandbox site, where you can try out the plugin functionalities, on this link

    and there is a 15-day money-back guarantee period, So if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)


    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  • Theo replied

    Hi Miloš 

    Thank you for the detailed help.

    I can see how some parts could work but there is one which I'm a bit unsure on still.

    Can a user be sent to a page with the parameters into a url which filters the results... but in a way where they are unable to see/hack via web tools to see other users info?

    The form captures some sensitive details on mental health and I wanted to use wpdatatables and the charts to present a review of their week or day.

    But they shouldn't be able to in any way be able to see or access OTHER peoples entries?

  •   Miloš replied privately
  •  1,689
    Miloš replied

    Hi, Theo

    I apologise for the waiting time, after consultations with senior colleagues, i realised i made a mistake.

    For the Gravity forms, we actually don't have any placeholders available.

    If you need to present only one row of data, it can be done either by setting "Default rows per page",

    or to use a filter.

    The only other way could be by using custom CSS.

    -

    I made a working example on our Sandbox here;  you can also try, you can make new Gravity Forms, make a new table, and a page, and experiment to see what you can get.

    -

    I made a simple Form with a text filed - and i was not aware of this, Gravity Forms already have this field you can use to record current date and time of each entry.

    2013543494.png
    5706326661.png
    9135441393.png

    -

    Then, when you link it to a table;

    If you set this date column to sort by, and set descending order;

    6398093205.png

    Then you can limit the rows displayed to  only 1, and remove the pagination info;

    like this :

    9438712320.png

    And this is how the default table looked, without all the settings , showing all rows :

    8558691998.png

    Now it is like this , only shows the last entry

    5722085213.png

    Of course, you can choose to hide any columns, you can also hide the filtering section, as needed.

    -

    And, to filter the data only for the currently logged in user, you can use this setting

    5602070600.png

    In Gravity settings > Filter by user.

    Let me know how that seems, if it can work, at least for the part of showing only the latest entry of a user.

    Thank you

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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