Skip to content

Commit

Permalink
If fueled user has a 10up account, update the email
Browse files Browse the repository at this point in the history
  • Loading branch information
tlovett1 committed Dec 11, 2024
1 parent 3045a2b commit c11291f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
23 changes: 20 additions & 3 deletions includes/classes/SSO/SSO.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down

0 comments on commit c11291f

Please sign in to comment.