You are correct about the row not having much use outside of a two day threshold where a user doesn’t activate their account.
I took a look at the codebase and can confirm there is no API function for removing a signup entry. The only code that removes a signup is the wpmu_validate_user_signup()
function. It checks against current signups for the same user_login
and user_email
. If either of those exist, it checks to see if that user registered within the last two days. They have two days to activate their account, or that user_login
or user_email
becomes available to someone else.
What I would do is hook into the wp_activate_user
hook to remove it immediately.
add_action( 'wpmu_activate_user', function( $user_id, $password, $meta ) {
global $wpdb;
// Sadly the user email isn't passed into the action
$user = get_user_by( 'id', $user_id );
if( $user ){
$wpdb->delete( $wpdb->signups, array( 'user_email' => $user->user_email ) );
}
}, 0, 3);