Using Gravity Forms ‘gform_activate_user’ PHP action

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.)

More information

See Gravity Forms Docs: gform_activate_user

This action is located in GF_User_Registration::activate_signup() in gravityformsuserregistration/includes/signups.php.

Examples

Add a Note

Add a note to the entry after a user signup has been activated.

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

Delete the entry after a user signup has been activated.

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);