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.

Multisite

  1. neonwired
    Member

    I'm running a network of sites using multisite and would like the same forms to be available to all sites for easy of maintenance and updating the forms in one place. Is this possible with gravity forms?

    Posted 11 years ago on Thursday May 3, 2012 | Permalink
  2. Currently, it's not possible to share a single form across all multi-site sites right now. You could install and activate gravity forms on one site and then use the iframe method to embed forms on the other sites. That could be an option for you to have a single entity/place to update.

    Finding a way to allow forms to be shared across a multi-site instance is something we'd like to tackle in the future. There is no eta on when it will be available, but it is something we'd like to find a solution for.

    Posted 11 years ago on Thursday May 3, 2012 | Permalink
  3. Is there a possibility to do a quick hack... something like

    if form_id does not exist in the sub-domain site && admin setting is to use primary site forms on the sub-domains {
    set wpdb->prefix to primary site's in forms_model.php
    }

    in theory, when the gravity_forms function calls the RGForms class::get_form function, hopefully with the above technique the $form_table_name, $lead_table_name, $view_table_name will be set to the primary blog table names.

    What do you think?

    Posted 11 years ago on Friday May 4, 2012 | Permalink
  4. Just to add a potential user to this. I was looking at using Gravity Forms on a multi-siite, in the way described.

    Posted 11 years ago on Tuesday May 8, 2012 | Permalink
  5. @Rob: I eventually settled with using WP options (GF_LICENSE_KEY and GF_IMPORT_FILE) and creating new forms by default whenever a new blog is created.

    my client's site - http://www.truth-diary.com
    what I am trying to achieve is - Whenever a trainer registers(1) on the primary WordPress blog (truth-diary.com), he gets a new sub-domain created like xyz.truth-diary.com and with the WP options now gets ready-made forms (registration + contact us). I would like the registration form to be per-configured with user registration module and paypal module. In other words, the trainer should not have to do anything to configure the registration form; it should all be out-of-the-box working.

    the bottleneck: the forms that are created via WP options do not replicate the settings in userregistration module for that specific form.

    question: is there a way to pre-configure (via php) userregistration + paypal settings in the newly created blog?

    (1) using a user registration form built with gravity forms where I collect the paypal email address of the trainer.

    Posted 11 years ago on Wednesday May 9, 2012 | Permalink
  6. I dug a bit deeper into WP .. and now I copy every (!) form and licence code ( no need to hardcode it in your wp-config ) from the main site to a newly created site. I anyone is interested in that code I will publish that.

    Hint: add_action('wpmu_new_blog', 'mp_new_blogs_setting', 10, 6);

    Posted 11 years ago on Saturday August 11, 2012 | Permalink
  7. @rl55
    I used your solution
    "if form_id does not exist in the sub-domain site && admin setting is to use primary site forms on the sub-domains {
    set wpdb->prefix to primary site's in forms_model.php
    }"
    ...and works fine, thanks!

    Posted 11 years ago on Thursday August 23, 2012 | Permalink
  8. Academic Technology
    Member

    Adding my +1 to enabling GF across a multisite network.

    Posted 11 years ago on Thursday September 13, 2012 | Permalink
  9. I didn't want to edit the plugin directly so tried to find an alternative way to display the main sites forms on sub sites. In the end I used the gravity forums shortcode filter.

    To pretty much output my own forms setting my own database prefix.

    I had trouble with the form submit so I modified the forms action to point to the main site.

    <?php
    add_filter('gform_shortcode_form', 'gform_shortcode_form_mu_override',10,3);
    
    function gform_shortcode_form_mu_override( $shortcode_string, $attributes, $content ){
    
        global $blog_id, $wpdb;
    
            $old_wp_prefix = $wpdb->prefix;
            $wpdb->prefix = 'wp_';
    
            require_once(GFCommon::get_base_path() . "/form_display.php");
            $new_form = GFFormDisplay::get_form($attributes['id'], $attributes['display_title'], $attributes['display_description'], $attributes['force_display'], $attributes['field_values'], $attributes['ajax'], $attributes['tabindex']);
    
            $wpdb->prefix = $old_wp_prefix;
    
            //replace the new forms action with one to the root site, rather than /sub-site/ which wouldn't process/submit
            $shortcode_string = preg_replace('/action=\'.*#/', 'action=\'/#', $new_form);
    
        return $shortcode_string;
    }
    Posted 11 years ago on Monday October 22, 2012 | Permalink
  10. That's a pretty neat solution. How is it working for you?

    Posted 11 years ago on Tuesday October 23, 2012 | Permalink
  11. Hi I would like to add that I also am looking for this feature. I think the work around was neat, but I was hoping to do the reverse in terms since I have a Wordpress MU site with 44 sub sites ( sub-domain set-up ). As this thread starts, I wanted have 4 shared forms that I wanted to have all subsites use and the parent site administrator to be able to change in one form.

    Can you please assist? I was able to implement the iframe suggestion but had to copy and import the main form to all 44 sub sites manually. As you can imagine just changing anything on those forms will become a pain since the changes would have to be repeated 44 times.

    I am bit confused as to why this is so difficult. Wordpress MU offers the switch_to_blog function which correctly set the $wpdb handler to the right context. So maybe extend the shortcode properties for gravity forms can include a switchtoblog property that would could be used to scope the form correctly?

    From previous posts and other similar request from users I have noticed that this still does not alleviate the issue of having to have the forms created in the sub sites since they need the table to capture the records, but looking the code in the plugin gravity_form.php if the scope of the $wpdb was already set by Wordpress it would already created the tables since that is what my read of deltaDb is doing.

    Any thoughts on this?

    Mario

    Posted 11 years ago on Friday October 26, 2012 | Permalink
  12. @Mario - please begin a new topic in the regular support forums for your issue as you are an existing license holder and this is a pre-purchase forum.

    Posted 11 years ago on Saturday October 27, 2012 | Permalink

This topic has been resolved and has been closed to new replies.