Custom Search Criteria – current user data

Custom Search Criteria – current user data

Here is another example of creating a custom criteria in order to filter form entries based on current user particular data. In this case, we are going to filter only entries which email field (number 2) matches with current user email.

Of course you need to register to test this one online! 🙂

Here is the input form!

  • Please enter a value between 0 and 10.

Here are the shortcodes to filter entries as needed

[gfchartsreports gf_form_id="7" include="1" exclude="" type="pie" color_set="blue" color_rand="false" width="40%" tooltip_style="BOTH" position="float" maxentries="" chart_js_options="title: {display: true, text: 'All entries without filter'}" custom_search_criteria=""/]
[gfchartsreports gf_form_id="7" include="1" exclude="" type="pie" color_set="blue" color_rand="false" width="40%" tooltip_style="BOTH" position="float" maxentries="" chart_js_options="title: {display: true, text: 'Only entries matching current user email'}" custom_search_criteria='{"status":"active","field_filters":{"0":{"key":"2","value":"user:user_email"}}}'/]

No answer to form Current user data (7) yet

You can potentially use any wordpress user meta key in the shortocde.

Similar Posts:

About The Author

Comments (16)

  • Joe Black

    Very impressive, works perfectly!!!
    Thank you.

    • Gravity Forms Charts Reports

      Oh, thank you very much Joe! 🙂

  • chriss

    Is it possible to have a “live search” to check if there is an entry for a specific field? ie: Location : “New York”, then to have a search box to see if new york has been entered already?

    • Gravity Forms Charts Reports

      Hi @chriss,
      Thank you for your proposal, are you using GravityView already ? It seems to be answering your demand.
      Else can you explain a bit more what you need ?

      • chriss

        Hi Thanks for the reply. No I am not using GravityView, I did have a look at it but it a little over kill for what I need. I just need to see if a value exists in the entries for a specific form input.

        So literally I want a text input that acts as a search, but it will only check 1 entry field to see if it has already been captured.

        • Gravity Forms Charts Reports

          Interesting @chriss, although this is not the main goal of the plugin currently. I will add it to the new features request list anyway ! 🙂

    • MaxiCharts

      Hi @chriss,

      An add on is under validation, which should do what you were looking for. Do you want to be a beta-tester of it, as soon as it is released ? 🙂

  • hamerdml@gmail.com

    Hi I would like to create a graph in the confirmation page for a single entry. Can Maxichart do that and can you guide me please ?

    • MaxiCharts

      Hello,
      Are you @wcpres on wp.org site ? 🙂

      • hamerdml@gmail.com

        No. This is my first comment. I have a gravity form which asks a person some questions and calculates a score in 3 fields. I then want to graph those 3 fields in a doughnut graph on the confirmation page for that particular form for that person only. I can get the doughnut chart to appear with the 3 fields displayed but it displays the data for all entries against that form. (I’m not a developer really – I’ve used your search code as a guide but I must have something wrong as it isn’t working. Thks

        • MaxiCharts

          Oh, sorry then, we had two similar requests at the same time…
          In order to get only the answers for the current user, is has to be logged in (and use something like the email as unique id), or you must have get the email inside the form and reuse it (with merge tag) on confirmation page in order to filter entries upon this cretieria.
          Do you have a public link to your page please ?

  • stubushell

    Hi Maxicharts I am seeing if i can have a simple filter being to only display logged in users data, not wanting to have a field propagating the trigger. is there a way of adding that into the shortcode filter?
    I have Gravity view displaying the data for logged in users only in a table, but the chart i have in the custom content shortcode, is pulling from all the data from all users. I want to only have the current logged in users data in the chart, so it matches the data displayed in the gravity view table. Thanks in advance for your help

    • MaxiCharts

      Hi @stubushell,
      Yes, this can be added, we need to investigate a bit.
      Cheers

      • stubushell

        Hi @MaxiCharts

        I got it sorted with some investigating and trial and error

        custom_search_criteria='{“status”:”active”,”field_filters”:{“0”:{“key”:”created_by”,”value”:”current”}}}’ /]

        • MaxiCharts

          Thanks for your interesting feedback, sharing with others

        • MaxiCharts

          We are going to make a post on this 🙂

Leave Comment