diff --git a/classes/Invitation.php b/classes/Invitation.php index 83625b3932..27ff400883 100644 --- a/classes/Invitation.php +++ b/classes/Invitation.php @@ -23,4 +23,11 @@ class Invitation extends Memcached_DataObject /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE + + function convert($user) + { + $orig = clone($this); + $this->registered_user_id = $user->id; + return $this->update($orig); + } } diff --git a/classes/User.php b/classes/User.php index 8642c78c27..9f79549327 100644 --- a/classes/User.php +++ b/classes/User.php @@ -263,6 +263,8 @@ class User extends Memcached_DataObject $user->nickname = $nickname; + $invite = null; + // Users who respond to invite email have proven their ownership of that address if (!empty($code)) { @@ -353,6 +355,12 @@ class User extends Memcached_DataObject return false; } + // Mark that this invite was converted + + if (!empty($invite)) { + $invite->convert($user); + } + if (!empty($email) && !$user->email) { $confirm = new Confirm_address();