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.

Child site gorms in a multisite do not get created until you login to backend

  1. I'm importing an XML (WXR) file to create a new child site with some defaults after a form is completed. This included some gravity forms but they don't become active (oops cannot find your form) until I go to the backend of the newly created child site.

    This appears to have something to do with a function that gets triggered by logging into the backend. Can you please help me find a way to trigger this function without having to go to the backend?

    Posted 13 years ago on Wednesday February 23, 2011 | Permalink
  2. upon further investigation, the gravity forms tables are not even created until the backend is accessed. I believe this has something to do with the setup() function needing to be triggered but I cannot make that happen. I've tried adding the following lines into my functions.php:

    add_action('init',  array('RGForms', 'init'));
    add_action('init',  array('RGForms', 'maybe_process_form'));
    Posted 13 years ago on Wednesday February 23, 2011 | Permalink
  3. nasty hack I have going on right now in my functions.php has it "working"

    /* Set Subsite Gravity Forms XML File Path */
    add_action( 'init', 'set_xml_path', 1 );
    add_action( 'init',  array('RGForms', 'init'), 2);
    add_action( 'init',  array('RGForms', 'setup'), 3);
    
    function set_xml_path( ){
    
      global $blog_id; 
    
      $xml_path = ABSPATH."wp-content/blogs.dir/".$blog_id."/gforms_files/gravityforms.xml";
      define( "GF_IMPORT_FILE", $xml_path );
    
      if(!class_exists("GFExport"))
           require_once(WP_PLUGIN_DIR . "/gravityforms/export.php");
    
    }

    Cleaner solution?

    Posted 13 years ago on Wednesday February 23, 2011 | Permalink
  4. If I understand the problem correctly (not sure that I do), the following should work.
    Note: I also removed the include to export.php. Do you really need it?

    /* Set Subsite Gravity Forms XML File Path */
    add_action( 'init', 'set_xml_path', 1 );
    
    function set_xml_path( ){
    
      global $blog_id; 
    
      $xml_path = ABSPATH."wp-content/blogs.dir/".$blog_id."/gforms_files/gravityforms.xml";
      define( "GF_IMPORT_FILE", $xml_path );
    
      RGForms::setup();
    
    }
    Posted 13 years ago on Wednesday February 23, 2011 | Permalink
  5. That results in:

    Fatal error: Class 'GFCommon' not found in /path/to/site/public/wp-content/plugins/gravityforms/gravityforms.php on line 217

    I tried lowering the priority to 2 as well, still fails (add_action( 'init', 'set_xml_path', 2 );)

    Posted 13 years ago on Wednesday February 23, 2011 | Permalink
  6. Gravity Forms gets initialized in the "init" hook with the default priority of 10.
    If you change your priority to 11, I am pretty sure it will work for you.

    Posted 13 years ago on Wednesday February 23, 2011 | Permalink
  7. Fatal error: Class 'GFExport' not found in /path/to/site/public/wp-content/plugins/gravityforms/gravityforms.php on line 346

    I tried changing it all the way down to 100, with no luck.

    Posted 13 years ago on Wednesday February 23, 2011 | Permalink