original_string: public function addUser($userLogin, $password, $email, $alias = false, $_isPasswordHashed = false, $initialIdSite = null)
      {
          Piwik::checkUserHasSomeAdminAccess();
  
          if (!Piwik::hasUserSuperUserAccess()) {
              if (empty($initialIdSite)) {
                  throw new \Exception(Piwik::translate("UsersManager_AddUserNoInitialAccessError"));
              }
  
              Piwik::checkUserHasAdminAccess($initialIdSite);
          }
  
          $this->checkLogin($userLogin);
          $this->checkEmail($email);
  
          $password = Common::unsanitizeInputValue($password);
  
          if (!$_isPasswordHashed) {
              UsersManager::checkPassword($password);
  
              $passwordTransformed = UsersManager::getPasswordHash($password);
          } else {
              $passwordTransformed = $password;
          }
  
          $alias               = $this->getCleanAlias($alias, $userLogin);
          $passwordTransformed = $this->password->hash($passwordTransformed);
          $token_auth          = $this->createTokenAuth($userLogin);
  
          $this->model->addUser($userLogin, $passwordTransformed, $email, $alias, $token_auth, Date::now()->getDatetime());
  
          // we reload the access list which doesn't yet take in consideration this new user
          Access::getInstance()->reloadAccess();
          Cache::deleteTrackerCache();
  
          /**
           * Triggered after a new user is created.
           *
           * @param string $userLogin The new user's login handle.
           */
          Piwik::postEvent('UsersManager.addUser.end', array($userLogin, $email, $password, $alias));
  
          if ($initialIdSite) {
              $this->setUserAccess($userLogin, 'view', $initialIdSite);
          }
      }
code: public function addUser($userLogin, $password, $email, $alias = false, $_isPasswordHashed = false, $initialIdSite = null)
      {
          Piwik::checkUserHasSomeAdminAccess();
  
          if (!Piwik::hasUserSuperUserAccess()) {
              if (empty($initialIdSite)) {
                  throw new \Exception(Piwik::translate("UsersManager_AddUserNoInitialAccessError"));
              }
  
              Piwik::checkUserHasAdminAccess($initialIdSite);
          }
  
          $this->checkLogin($userLogin);
          $this->checkEmail($email);
  
          $password = Common::unsanitizeInputValue($password);
  
          if (!$_isPasswordHashed) {
              UsersManager::checkPassword($password);
  
              $passwordTransformed = UsersManager::getPasswordHash($password);
          } else {
              $passwordTransformed = $password;
          }
  
          $alias               = $this->getCleanAlias($alias, $userLogin);
          $passwordTransformed = $this->password->hash($passwordTransformed);
          $token_auth          = $this->createTokenAuth($userLogin);
  
          $this->model->addUser($userLogin, $passwordTransformed, $email, $alias, $token_auth, Date::now()->getDatetime());
  
          // we reload the access list which doesn't yet take in consideration this new user
          Access::getInstance()->reloadAccess();
          Cache::deleteTrackerCache();
  
          /**
           * Triggered after a new user is created.
           *
           * @param string $userLogin The new user's login handle.
           */
          Piwik::postEvent('UsersManager.addUser.end', array($userLogin, $email, $password, $alias));
  
          if ($initialIdSite) {
              $this->setUserAccess($userLogin, 'view', $initialIdSite);
          }
      }
code_tokens: public function addUser ( $ userLogin , $ password , $ email , $ alias = false , $ _isPasswordHashed = false , $ initialIdSite = null ) { Piwik :: checkUserHasSomeAdminAccess ( ) ; if ( ! Piwik :: hasUserSuperUserAccess ( ) ) { if ( empty ( $ initialIdSite ) ) { throw new \ Exception ( Piwik :: translate ( "UsersManager_AddUserNoInitialAccessError" ) ) ; } Piwik :: checkUserHasAdminAccess ( $ initialIdSite ) ; } $ this -> checkLogin ( $ userLogin ) ; $ this -> checkEmail ( $ email ) ; $ password = Common :: unsanitizeInputValue ( $ password ) ; if ( ! $ _isPasswordHashed ) { UsersManager :: checkPassword ( $ password ) ; $ passwordTransformed = UsersManager :: getPasswordHash ( $ password ) ; } else { $ passwordTransformed = $ password ; } $ alias = $ this -> getCleanAlias ( $ alias , $ userLogin ) ; $ passwordTransformed = $ this -> password -> hash ( $ passwordTransformed ) ; $ token_auth = $ this -> createTokenAuth ( $ userLogin ) ; $ this -> model -> addUser ( $ userLogin , $ passwordTransformed , $ email , $ alias , $ token_auth , Date :: now ( ) -> getDatetime ( ) ) ; // we reload the access list which doesn't yet take in consideration this new user Access :: getInstance ( ) -> reloadAccess ( ) ; Cache :: deleteTrackerCache ( ) ; /**
           * Triggered after a new user is created.
           *
           * @param string $userLogin The new user's login handle.
           */ Piwik :: postEvent ( 'UsersManager.addUser.end' , array ( $ userLogin , $ email , $ password , $ alias ) ) ; if ( $ initialIdSite ) { $ this -> setUserAccess ( $ userLogin , 'view' , $ initialIdSite ) ; } }
docstring: Add a user in the database.
  A user is defined by
  - a login that has to be unique and valid
  - a password that has to be valid
  - an alias
  - an email that has to be in a correct format
  
  @see userExists()
  @see isValidLoginString()
  @see isValidPasswordString()
  @see isValidEmailString()
  
  @exception in case of an invalid parameter
docstring_tokens: Add a user in the database . A user is defined by - a login that has to be unique and valid - a password that has to be valid - an alias - an email that has to be in a correct format