WordPress.org

Forums

[Plugin: Gravity Forms] Centralized Registration on MU sites (1 post)

  1. jester48
    Member
    Posted 1 year ago #

    I have a multi-site installation with 5 sites and i am using Gravity Forms and the Registration add-on to allow users to register.
    Initially there was to be one registration form which was to register all users art the parent site level, however for one site the requirements were changed and a single form was no longer viable.

    currently i have implement a registration form on all sites, but i would like the functionality of the single site registration; all users on the main site and then assigned to sub-sites by the admin.

    does any one know of a method to achieve this?

    i found this, but not sure if this will work in my implementation with sub-sites rather than sub-directories, also about a year old

    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 = 'rbrtravel_';
    
            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;
    }

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic