gform_user_registration_add_option_section

Removed: This hook was removed in version 3.0 and replaced by gform_userregistration_feed_settings_fields.

Description

Used to add a custom option section to the User Registration Feed (similar to how BuddyPress and Multisite are integrated with the User Registration add-on).

Usage

Applies to all forms.

add_action( 'gform_user_registration_add_option_section', 'your_function_name', 10, 3 );

Parameters

  • $config array
    The User Registration configuration array.
  • $form Form Object
    The Form Object for which the current user registration feed is for.
  • $is_validation_error boolean
    Boolean value indicating whether there was a validation error with the User Registration configuration.

Examples

This example is a bit of modified code from the User Registration source code that demonstrates how the Multisite section was added to the feed page.

add_action( 'gform_user_registration_add_option_section', 'add_multisite_section', 10, 3 );
function add_multisite_section( $config, $form, $is_validation_error ) {

    get_current_site();

    $form_fields = self::get_form_fields($form);
    $multisite_options = $config['meta']['multisite_options'];
    $parent_blog = get_dashboard_blog();
    $current_blog = $GLOBALS['blog_id'];

    if($parent_blog->blog_id != $current_blog)
        return;

    ?>

    <div id="multsite_options" class="multsite_options">

        <h3>Multisite Options</h3>

        <div class="margin_vertical_10">
            <label class="left_header"><?php _e("Create Site", "gravityformsuserregistration"); ?> <?php gform_tooltip("user_registration_multisite_create_site") ?></label>
            <input type="checkbox" id="gf_user_registration_multisite_create_site" name="gf_user_registration_multisite_create_site" value="1" <?php echo ($multisite_options['create_site'] == 1) ? "checked='checked'" : "" ?> onclick="if(this.checked){jQuery('#multisite_option_items').fadeIn('fast');} else{jQuery('#multisite_option_items').fadeOut('fast');}" />
            <label for="gf_user_registration_multisite_create_site" class="checkbox-label"><?php _e("Create new site when a user registers.", "gravityformsuserregistration"); ?></label>
        </div> <!-- / send email? -->

        <div id="multisite_option_items" style="<?php echo ($multisite_options['create_site'] == 1) ? 'display:block;' : 'display:none;'; ?>">

            <div class="margin_vertical_10 <?php echo ($is_validation_error &amp;&amp; empty($multisite_options['site_address']) ) ? 'user_registration_validation_error' : *; ?>">
                <label class="left_header" for="gf_user_registration_multisite_site_address"><?php _e("Site Address", "gravityformsuserregistration"); ?> <span class="description">(required)</span> <?php gform_tooltip("user_registration_multisite_site_address") ?></label>
                <?php echo self::get_field_drop_down("gf_user_registration_multisite_site_address", $form_fields, $multisite_options['site_address'], "width-1 standard-meta"); ?>
            </div>

            <div class="margin_vertical_10 <?php echo ($is_validation_error &amp;&amp; empty($multisite_options['site_title']) ) ? 'user_registration_validation_error' : *; ?>">
                <label class="left_header" for="gf_user_registration_multisite_site_title"><?php _e("Site Title", "gravityformsuserregistration"); ?>  <span class="description">(required)</span> <?php gform_tooltip("user_registration_multisite_site_title") ?></label>
                <?php echo self::get_field_drop_down("gf_user_registration_multisite_site_title", $form_fields, $multisite_options['site_title'], "width-1 standard-meta"); ?>
            </div>

        </div>

    </div> <!-- / multisite options -->

    <?php
}

Source Code

This action hook is located in userregistration.php.