Multisite: Delete the signup entry when a user is deleted from the database.

When a user has registered with incorrect data and got the account deleted immediately, it currently wasn't possible to register with the same login or email address again due to the existing signup entry. They had to wait for two days until the entry gets automatically deleted. Now the associated signup entry gets deleted as part of the account deletion.

Fixes #43232.
Built from https://develop.svn.wordpress.org/trunk@48315


git-svn-id: http://core.svn.wordpress.org/trunk@48084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2020-07-05 11:21:03 +00:00
parent de751a91db
commit 6496c61741
3 changed files with 17 additions and 1 deletions

View File

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

View File

@ -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.
*

View File

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