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.

Import hook?

  1. I don't see any hook for an import function and I would really like to automate the process of importing gravity forms XML upon a sub-site creation in a wordpress multisite network setup.

    Can an import hook be added or is there any hack-arounds for this?

    Posted 13 years ago on Friday December 3, 2010 | Permalink
  2. You can automatically import forms by defining the full path to an XML export file via a global variable "GF_IMPORT_FILE"
    define("GF_IMPORT_FILE", "/root/folder/gf_import.xml");

    Posted 13 years ago on Friday December 3, 2010 | Permalink
  3. boom baby

    Posted 13 years ago on Friday December 3, 2010 | Permalink
  4. The problem I have now, is these sites need different absolute urls in their xml (based on the newly created site url). Generating the xml is easy enough but telling the wp-config where to look for it is a different story.

    I either need:
    a) a unique file name
    b) a unique folder

    to put them in... but I need the wp-config know that unique variable. Any ideas?

    Posted 13 years ago on Monday December 6, 2010 | Permalink
  5. It sounds like you will need to define your global variable outside of the wp-config.php.
    You just need to make sure it happens before the Gravity Forms init() function. Using the WP "init" hook with a priority lower than 10 should probably be what you need.

    add_action('init',  'set_xml_path', 9);
    function set_xml_path(){
       $xml_path = generate_dinamically();
       define("GF_IMPORT_FILE", $xml_path);
    }
    Posted 13 years ago on Monday December 6, 2010 | Permalink
  6. Curious if this works with sites that are NOT multi site. Anyone know?

    Posted 12 years ago on Friday July 6, 2012 | Permalink
  7. David Peralty

    I don't know of any reason that it shouldn't. Give it a try and let us know if you have any issues.

    Posted 12 years ago on Friday July 6, 2012 | Permalink