gform_activate_user

Description

The “gform_activate_user” action fires after a user signup has been activated. This action is used in the User Registration plugin for Gravity Forms.

Usage

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

Parameters

  • $user_id int

    The user id of the signup user just activated.

  • $user_data array

    An array of the user information.

  • $signup_meta array

    All the metadata in an array (user login, email, password, etc.)

Example

Add a Note

add_action( 'gform_activate_user', 'after_user_activate', 10, 3 );
function after_user_activate( $user_id, $user_data, $signup_meta ) {
	// Add note to entry.
	GFFormsModel::add_note( $signup_meta['entry_id'], $user_id, 'admin', 'The user signup has completed for ' . $user_data['display_name'] . '.');
}

Delete Entry

add_action( 'gform_activate_user', function( $user_id, $user_data, $signup_meta ) {
	// Delete the entry.
	GFAPI::delete_entry( $signup_meta['entry_id'] );
	GFCommon::log_debug( __METHOD__ . '(): Entry deleted after user activation, ID: ' . $signup_meta['entry_id'] );
}, 10, 3 );

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 is located in GF_User_Registration::activate_signup() in gravityformsuserregistration/includes/signups.php.