static function createTemporaryUser($real_name, $email) { $user = new User(); $maxid = User::getMaxID(); $anonid = $maxid + 1; $username = "******"; $user->setName($username); $real_name = strip_tags($real_name); // make sure this hasn't already been created while ($user->idForName() > 0) { $anonid = rand(0, 100000); $username = "******"; $user->setName($username); } if ($real_name) { $user->setRealName($real_name); } else { $user->setRealName("Anonymous"); } if ($email) { $user->setEmail($email); } $user->setPassword(WH_ANON_USER_PASSWORD); $user->setOption("disablemail", 1); $user->addToDatabase(); return $user; }
/** * Determine whether the user is a newbie. Newbies are either * anonymous IPs, or the 1% most recently created accounts. * Bots and sysops are excluded. * @return bool True if it is a newbie. */ function isNewbie() { return $this->isAnon() || $this->mId > User::getMaxID() * 0.99 && !$this->isAllowed('delete') && !$this->isBot(); }