gform_user_registration_add_option_group

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

Description

Used to add a group of options to the “Additional Options” section of the User Registration Feed. Useful when you want to add one or two options without requiring a whole section.

Usage

Applies to all forms.

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

Parameters

ParameterTypeDescription
$configarrayThe User Registration configuration array.
$formForm ObjectThe Form Object for which the current user registration feed is for.
$is_validation_errorbooleanBoolean value indicating whether there was a validation error with the User Registration configuration.

Examples

Add the Send User Email option.

This example shows how to add the “Send User Email” option (available by default in the User Registration) using the gform_user_registration_add_option_group as if this option was no already available.

add_action( 'gform_user_registration_add_option_group', 'add_custom_group', 10, 3 );
function add_multisite_section( $config, $form, $is_validation_error ) {
	?>

	<div class="margin_vertical_10">
		<label class="left_header"><?php _e( "Send Email?", "gravityformsuserregistration" ); ?> <?php gform_tooltip( "user_registration_notification" ) ?></label>
		<input type="checkbox" id="gf_user_registration_notification" name="gf_user_registration_notification" value="1" <?php echo ( $config["meta"]["notification"] == 1 || ! isset( $config["meta"]["notification"] ) ) ? "checked='checked'" : "" ?> />
		<label for="gf_user_registration_notification" class="checkbox-label"><?php _e( "Send this password to the new user by email.", "gravityformsuserregistration" ); ?></label>
	</div> <!-- / send email? -->

	<?php
}

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This action hook is located in userregistration.php.