+ // Index the user, to allow her to appear in searches.
+ require_once('user.func.inc.php');
+ user_reindex($uid);
+
+ // Notify other users which were watching for her arrival.
+ require_once 'notifs.inc.php';
+ register_watch_op($uid, WATCH_INSCR);
+ inscription_notifs_base($uid);
+
+ // Forcibly register the new user on default forums.
+ $promo_forum = 'xorg.promo.x' . $promo;
+ $registered_forums = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $promo_forum);
+ foreach ($registered_forums as $forum) {
+ XDB::execute("INSERT INTO forums.abos (fid,uid)
+ SELECT fid, {?}
+ FROM forums.list
+ WHERE nom = {?}",
+ $uid, $val);
+
+ // Notify the newsgroup admin of the promotion forum needs be created.
+ if (XDB::affectedRows() == 0 && $forum == $promo_forum) {
+ $res = XDB::query("SELECT SUM(perms IN ('admin','user') AND deces = 0), COUNT(*)
+ FROM auth_user_md5
+ WHERE promo = {?}", $promo);
+ list($promo_registered_count, $promo_count) = $res->fetchOneRow();
+ if ($promo_registered_count > 0.2 * $promo_count) {
+ $mymail = new PlMailer('admin/forums-promo.mail.tpl');
+ $mymail->assign('promo', $promo);
+ $mymail->send();
+ }
+ }
+ }
+
+ // Update the global registration count stats.
+ $globals->updateNbIns();
+
+ // 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_MDP);
+
+ //
+ // Update collateral data sources, and inform watchers by email.
+ //