The gform_userregistration_delete_signup action allows you to perform custom actions when pending activations are deleted in Gravity Forms.
Usage
add_action('gform_userregistration_delete_signup', 'your_function_name');
Parameters
- $signup (object): An object containing signup information.
More information
See Gravity Forms Docs: gform_userregistration_delete_signup
This action was added in User Registration version 3.0. The source code is located in GFUserSignups::delete_signup() in includes/signups.php
.
Examples
Log Deletions
Log the deletion of non-admin signups.
add_action('gform_userregistration_delete_signup', 'log_deleted_signup'); function log_deleted_signup($signup) { // Check if the user is not an admin if ($signup->user_login != 'admin') { // Log the deletion error_log("Deleted signup for: " . $signup->user_login); } }
Send Email Notification
Send an email notification when a pending activation is deleted.
add_action('gform_userregistration_delete_signup', 'send_email_notification'); function send_email_notification($signup) { $to = '[email protected]'; $subject = 'Pending activation deleted'; $message = "A pending activation for user {$signup->user_login} has been deleted."; wp_mail($to, $subject, $message); }
Custom Cleanup
Perform custom cleanup actions when a pending activation is deleted.
add_action('gform_userregistration_delete_signup', 'custom_cleanup'); function custom_cleanup($signup) { // Perform custom cleanup actions }
Delete User Metadata
Delete user metadata when a pending activation is deleted.
add_action('gform_userregistration_delete_signup', 'delete_user_metadata'); function delete_user_metadata($signup) { $user_id = $signup->user_id; delete_user_meta($user_id, 'your_meta_key'); }
Add Deleted Signups to a Custom Table
Add deleted signups to a custom database table.
add_action('gform_userregistration_delete_signup', 'add_to_deleted_signups_table'); function add_to_deleted_signups_table($signup) { global $wpdb; $table_name = $wpdb->prefix . 'deleted_signups'; $wpdb->insert($table_name, array( 'user_login' => $signup->user_login, 'user_email' => $signup->user_email, 'deleted_at' => current_time('mysql') )); }