İlk cevap verene daha fazla puan vermek istiyorum… Nasıl yapabilirim? Yardımcı olabilir misiniz? @Alshain

    miranekmen Money eklentisi kurulu mu?

    Eğer kurulu ise şunları yapın 🙂

    money eklentisinin altında src/events/GiveMoney.php ’nin altına

    subscribe fonksiyonunun nun içine bunu ekleyin.

    public function subscribe(Dispatcher $events)
        {
            $events->listen(Posted::class, [$this, 'ErkenCevap']);
    
        }

    Daha sonra yeni fonksiyon oluşturun.

    public function ErkenCevap(Posted $event)
        {
            $discussmoney = (float)$this->settings->get('antoinefr-money.moneyfordiscussion', 0);
            $postmoney = (float)$this->settings->get('antoinefr-money.moneyforpost', 0);
            if ($event->post['number'] == 2 ) {
          
                    $post = $event->post['discussion_id'];
                    $kullanicipost = Post::query()->where('discussion_id', $post)
                        ->where('user_id', $event->post->user_id)
                        ->get()->count();
    
                    if (strlen(trim($event->post->content)) > 20 && $kullanicipost < 2) {
                          $this->giveMoney($event->post->user, $postmoney / 2);
                    }
                }
       }

    Bu şekilde 20 harf ve üzeri cevap yazan ilk kişi cevap için belirlediğiniz değerin yarısını ek olarak alır.

      Alshain Kodu ekleyince, verilen ilk cevaplarda birşeyler ters gitti hatası görülüyor.

      public function subscribe(Dispatcher $events) {
      $events->listen(Posted::class, [$this, 'postWasPosted']);
      $events->listen(PostRestored::class, [$this, 'postWasRestored']);
      $events->listen(PostHidden::class, [$this, 'postWasHidden']);
      $events->listen(Started::class, [$this, 'discussionWasStarted']);
      $events->listen(DiscussionRestored::class, [$this, 'discussionWasRestored']);
      $events->listen(DiscussionHidden::class, [$this, 'discussionWasHidden']);
      $events->listen(Saving::class, [$this, 'userWillBeSaved']);
      $events->listen(Posted::class, [$this, 'ErkenCevap']);
      }

       public function ErkenCevap(Posted $event)
          {
              $discussmoney = (float)$this->settings->get('antoinefr-money.moneyfordiscussion', 0);
              $postmoney = (float)$this->settings->get('antoinefr-money.moneyforpost', 0);
              if ($event->post['number'] == 2 ) {
            
                      $post = $event->post['discussion_id'];
                      $kullanicipost = Post::query()->where('discussion_id', $post)
                          ->where('user_id', $event->post->user_id)
                          ->get()->count();
      
                      if (strlen(trim($event->post->content)) > 75 && $kullanicipost < 2) {
                            $this->giveMoney($event->post->user, $postmoney / 2);
                      }
                  }
         }

      Şuan sitedeki ayarlar bu şekilde.

        SanalAnsiklopedim Hocam kodlarda problem yok gibi gözüküyor. Bende binlerce satır kod var. Bunu kendim düzenledim ama sorun yok gibi gözüküyor aslında.

          SanalAnsiklopedim

          if ($event->post[‘number’] == 2 ) {

          yerine tek eşittir koyup deneyebilir misiniz? O da olmazsa $kullanicipost bölümünü silip bir de öyle deneyin.

            Alshain

            == kısmının birini sildim olmadı.

             $post = $event->post['discussion_id'];
                            $kullanicipost = Post::query()->where('discussion_id', $post)
                                ->where('user_id', $event->post->user_id)
                                ->get()->count();
            
             if (strlen(trim($event->post->content)) > 20 && $kullanicipost < 2) {
                                  $this->giveMoney($event->post->user, $postmoney / 2);
                            }

            Kullanıcı post kısmı ile alakalı. Buradaki bütün kodu sileceğim değil mi?

              SanalAnsiklopedim

              public function ErkenCevap(Posted $event)
                  {
                      $discussmoney = (float)$this->settings->get('antoinefr-money.moneyfordiscussion', 0);
                      $postmoney = (float)$this->settings->get('antoinefr-money.moneyforpost', 0);
                      if ($event->post['number'] ==  2 ) {
                              if (strlen(trim($event->post->content)) > 75) {
                                    $this->giveMoney($event->post->user, $postmoney / 2);
                              }
                          }
                 }

                Alshain
                Teşekkürler sorun halloldu. 🙂 Şuan normal cevap ücreti uyguluyor ilk cevaplara. Hani bir farkı olmadı gibi. 😃

                Şöyle deyim; cevap ve konular 0.020 puan bizde. İlk cevabı 0.030 yapmak istiyoruz.

                Bu işlem sanırım; $this->giveMoney($event->post->user, $postmoney / 2); ile alakalı. Ben burayı her ne kadar değiştirsem de (8-10-20) etki olmuyor. Sizde bulunan diğer fonksiyonlar ile mi bağlantılı acaba?

                  SanalAnsiklopedim Hocam sadece ilk cevaplar için geçerli bu özellik. İsterseniz şöyle deneyin.

                  public function ErkenCevap(Posted $event)
                      {
                          $discussmoney = (float)$this->settings->get('antoinefr-money.moneyfordiscussion', 0);
                          $postmoney = (float)$this->settings->get('antoinefr-money.moneyforpost', 0);
                                  if (strlen(trim($event->post->content)) > 75) {
                                        $this->giveMoney($event->post->user, $postmoney / 2);
                                  }
                     }

                  Bu şekilde bütün cevapların %50 daha fazla para kazanması lazım. Deneyebilir misiniz?

                    Alshain
                    Evet. İlk cevaplar için yapmaya çalışıyorum bende zaten. 🙂 Deneme konu açıp, İlk cevap olarak deniyorum, fakat normal cevap ücreti yansıyor.

                      8 gün sonra

                      Alshain Hocam bahsettiğiniz eklentiyi nereye kuruyoruz yardımcı olabilir misiniz?

                        tupac Konsolda aşağıdaki komutu çalıştırın. Meney adındaki eklentiyi kurmanız lazım.

                        composer require antoinefr/flarum-ext-money

                          mekici Hocam çok soru soruyorum biliyorum 😀 Ama composer kullanmadım hiç . Meny eklentisini nasıl nereye kuruyoruz. Sizinde başınızı ağrıtıyorum kusura bakmayın.

                            tupac Sunucunuz var mı yoksa hostingde mi kullanıyorsun Flarum’u?

                              Hadımköy Kombi Servisi Minecraft Türk Sunucular