PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Creating a link to download csv

  1. thesportsphysio
    Member

    I would like to create a link to download with one click the csv files of one date.

    This csv file would only contain some predefined elements from the whole data available

    This date could be the one currently being viewed or chosen from a calendar (maybe the default WP calendar widget for ease.

    This link ideally I would like to put outside of the admin area, ideally on a page.

    Is this possible, and how would I go about it please?

    Posted 15 years ago on Wednesday November 25, 2009 | Permalink
  2. Gravity Forms does not currently support that, but it can be done with some lines of PHP. If you have a developer that can help you with this, we can point him in the right direction.

    Posted 15 years ago on Wednesday November 25, 2009 | Permalink
  3. thesportsphysio
    Member

    Thanks for the offer. Just me as the developer, so any advice would be much appreciated.

    Posted 15 years ago on Wednesday November 25, 2009 | Permalink
  4. You can start by looking at the start_export() function that is in the export.php file. All the export logic is basically in there. You can copy and paste that function into your page template and start tweaking it. If you look at the top of the function, you will see the following lines of code

    $form_id=$_POST["form_id"];
    $fields = explode(",", $_POST["fields"]);
    $start_date = $_POST["start_date"];
    $end_date = $_POST["end_date"];

    You will need to change those variables to match what you want. I am assuming you will be passing all of them via query string instead of post. $fields is a comma separated list of the filed ids you want to export.
    If you set this variables correctly, you will end up with the export file in yours wp-upload/gravity_forms/form_id folder.
    From there you can send that file to the user.
    Look at the download.php file for that.

    Let me know how it goes.

    Posted 15 years ago on Thursday November 26, 2009 | Permalink
  5. thesportsphysio
    Member

    Think this is going to need a bit more knowledge or possibly the suggestion of a plugin / feature request maybe?

    I sort of hoped I could put the selection form into a page with a copy and paste of a few lines of code.

    Unless anyone knows how to do this?

    Cheers
    a

    Posted 15 years ago on Thursday November 26, 2009 | Permalink
  6. thesportsphysio
    Member

    Can anyone suggest a step by step way to achieve a download link of core info ( not ips urls etc).

    Ideally I could do with this link outside of the admin setup ( user login not guest i suppose i mean) . So maybe linked from the bottom of the home page.

    I suppose it should have a start and end date option to make things a little bit more neat.

    I do have some knowledge but don't really know my way around php that well.

    Help - really would appreciate it.!

    a

    Posted 15 years ago on Thursday November 26, 2009 | Permalink