diff --git a/wp-includes/ms-default-filters.php b/wp-includes/ms-default-filters.php index d0054b502e..042751e491 100644 --- a/wp-includes/ms-default-filters.php +++ b/wp-includes/ms-default-filters.php @@ -31,6 +31,7 @@ add_action( 'network_site_new_created_user', 'wp_send_new_user_notifications' ); add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications' ); add_action( 'network_user_new_created_user', 'wp_send_new_user_notifications' ); add_filter( 'sanitize_user', 'strtolower' ); +add_action( 'deleted_user', 'wp_delete_signup_on_user_delete', 10, 3 ); // Roles. add_action( 'switch_blog', 'wp_switch_roles_and_user', 1, 2 ); diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index c2af99ef55..9707818787 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -1276,6 +1276,21 @@ function wpmu_activate_signup( $key ) { ); } +/** + * Deletes am associated signup entry when a user is deleted from the database. + * + * @since 5.5.0 + * + * @param int $id ID of the user to delete. + * @param int|null $reassign ID of the user to reassign posts and links to. + * @param WP_User $user User object. + */ +function wp_delete_signup_on_user_delete( $id, $reassign, $user ) { + global $wpdb; + + $wpdb->delete( $wpdb->signups, array( 'user_login' => $user->user_login ) ); +} + /** * Create a user. * diff --git a/wp-includes/version.php b/wp-includes/version.php index b2243ec6d2..d5ab5b3b9c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48314'; +$wp_version = '5.5-alpha-48315'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.