Automatically disconnect after auth-groupe-x authentication.
[platal.git] / modules / register.php
index fd9bdd3..27478a1 100644 (file)
@@ -385,6 +385,10 @@ class RegisterModule extends PLModule
         }
         XDB::commit();
 
+        // Try to start a session (so the user don't have to log in); we will use
+        // the password available in Post:: to authenticate the user.
+        Platal::session()->start(AUTH_PASSWD);
+
         // Add the registration email address as first and only redirection.
         require_once 'emails.inc.php';
         $user = User::getSilentWithUID($uid);
@@ -400,10 +404,6 @@ class RegisterModule extends PLModule
             update_alias_user($old_account_email, $user->forlifeEmail());
         }
 
-        // Try to start a session (so the user don't have to log in); we will use
-        // the password available in Post:: to authenticate the user.
-        Platal::session()->start(AUTH_PASSWD);
-
         // Subscribe the user to the services she did request at registration time.
         require_once 'newsletter.inc.php';
         foreach (explode(',', $services) as $service) {
@@ -461,9 +461,9 @@ class RegisterModule extends PLModule
 
         // Notify other users which were watching for her arrival.
         XDB::execute('INSERT INTO  contacts (uid, contact)
-                           SELECT  uid, ni_id
+                           SELECT  uid, {?}
                              FROM  watch_nonins
-                            WHERE  ni_id = {?}', $uid);
+                            WHERE  ni_id = {?}', $pid, $uid);
         XDB::execute('DELETE FROM  watch_nonins
                             WHERE  ni_id = {?}', $uid);
         Platal::session()->updateNbNotifs();