original_string: public static function updateInheritedAccount()
      {
          if (!Podium::getInstance()->user->isGuest) {
              $userNameField = Podium::getInstance()->userNameField;
              if ($userNameField === null) {
                  return true;
              }
              if (empty(Podium::getInstance()->user->identity->$userNameField)) {
                  throw new InvalidConfigException("Non-existing or empty '$userNameField' field!");
              }
              $savedUser = static::find()->where(['inherited_id' => Podium::getInstance()->user->id])->limit(1)->one();
              if (empty($savedUser)) {
                  throw new InvalidConfigException('Can not find inherited account in database!');
              }
              if ($savedUser->username === Podium::getInstance()->user->identity->$userNameField) {
                  return true;
              }
              $savedUser->scenario = 'installation';
              $savedUser->username = Podium::getInstance()->user->identity->$userNameField;
              if ($savedUser->save()) {
                  Log::info('Inherited account updated', $savedUser->id, __METHOD__);
                  return true;
              }
              throw new Exception('Inherited account updating error');
          }
          return true;
      }
code: public static function updateInheritedAccount()
      {
          if (!Podium::getInstance()->user->isGuest) {
              $userNameField = Podium::getInstance()->userNameField;
              if ($userNameField === null) {
                  return true;
              }
              if (empty(Podium::getInstance()->user->identity->$userNameField)) {
                  throw new InvalidConfigException("Non-existing or empty '$userNameField' field!");
              }
              $savedUser = static::find()->where(['inherited_id' => Podium::getInstance()->user->id])->limit(1)->one();
              if (empty($savedUser)) {
                  throw new InvalidConfigException('Can not find inherited account in database!');
              }
              if ($savedUser->username === Podium::getInstance()->user->identity->$userNameField) {
                  return true;
              }
              $savedUser->scenario = 'installation';
              $savedUser->username = Podium::getInstance()->user->identity->$userNameField;
              if ($savedUser->save()) {
                  Log::info('Inherited account updated', $savedUser->id, __METHOD__);
                  return true;
              }
              throw new Exception('Inherited account updating error');
          }
          return true;
      }
code_tokens: public static function updateInheritedAccount ( ) { if ( ! Podium :: getInstance ( ) -> user -> isGuest ) { $ userNameField = Podium :: getInstance ( ) -> userNameField ; if ( $ userNameField === null ) { return true ; } if ( empty ( Podium :: getInstance ( ) -> user -> identity -> $ userNameField ) ) { throw new InvalidConfigException ( "Non-existing or empty '$userNameField' field!" ) ; } $ savedUser = static :: find ( ) -> where ( [ 'inherited_id' => Podium :: getInstance ( ) -> user -> id ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ savedUser ) ) { throw new InvalidConfigException ( 'Can not find inherited account in database!' ) ; } if ( $ savedUser -> username === Podium :: getInstance ( ) -> user -> identity -> $ userNameField ) { return true ; } $ savedUser -> scenario = 'installation' ; $ savedUser -> username = Podium :: getInstance ( ) -> user -> identity -> $ userNameField ; if ( $ savedUser -> save ( ) ) { Log :: info ( 'Inherited account updated' , $ savedUser -> id , __METHOD__ ) ; return true ; } throw new Exception ( 'Inherited account updating error' ) ; } return true ; }
docstring: Updates inherited account's username.
  @return bool
  @throws Exception
  @throws InvalidConfigException
  @since 0.8
docstring_tokens: Updates inherited account s username .