diff --git a/CHANGELOG.md b/CHANGELOG.md index 739c9b7..252349f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/). +## [1.13.0] - 2024-12-09 + +* Turn on Fueled SSO by default +* Convert users to @fueled.com emails + + ## [1.12.1] - 2024-09-24 - Add filter for allowlisting specific API routes `tenup_experience_rest_api_allowlist` diff --git a/includes/classes/SSO/SSO.php b/includes/classes/SSO/SSO.php index 7d1988d..97109bf 100644 --- a/includes/classes/SSO/SSO.php +++ b/includes/classes/SSO/SSO.php @@ -228,9 +228,26 @@ public function process_client_login() { $user_id = false; $user = get_user_by( 'email', $email ); - if ( ! $user ) { - $short_email = str_replace( '@get10up.com', '@10up.com', $email ); - $user = get_user_by( 'email', $short_email ); + + if ( ! $user && preg_match( '#@fueled\.com$#i', $email ) ) { + // Check if fueled person had a 10up email + $old_10up_email = str_replace( '@fueled.com', '@get10up.com', $email ); + $tenup_user = get_user_by( 'email', $old_10up_email ); + + if ( $tenup_user ) { + // Turn off email change notification + add_filter( 'send_email_change_email', '__return_false' ); + + // Update tenup user to use fueled email + wp_update_user( + array( + 'ID' => $tenup_user->ID, + 'user_email' => $email, + ) + ); + + $user = get_user_by( 'id', $tenup_user->ID ); + } } if ( ! $user ) {