Cupara
Well-known member
No matter what I have done I still get undefined variable of $pointsEarned but yet it worked before then I updated it to 1.2 and added more features now I get this error when trying to make a new thread or post a reply.
	
	
	
		
				
			
		PHP:
	
	  protected function _postSaveAfterTransaction()
   {
     $userId = $this->get('user_id');
     $options = XenForo_Application::get('options');
     if($options->xfpoints_currency_size > 0)
     {
           if (xfPoints_Check::checkPostQuality($this) && $this->get('message_state') == 'visible')
           {
                 if ($this->isInsert() || $this->getExisting('message_state') == 'moderated')
                 {
                   if ($this->get('position') == 0)
                   {
                     $pointsModel = $this->getModelFromCache('xfPoints_Model_Currency');
                     $pointsEarned = $pointsModel->assignUserPoints($userId, 'thread') + $pointsModel->assignUserPoints($userId, 'size');
                     $pointsModel->updateUserPoints($userId, $pointsEarned);
                   }
                 }
           }
       } else {
         if ($this->get('message_state') == 'visible')
           {
               // add points to this user's total
               if ($this->get('message_state') == 'visible')
               {
                 if ($this->isInsert() || $this->getExisting('message_state') == 'moderated')
                 {
                   $pointsModel = $this->getModelFromCache('xfPoints_Model_Currency');
                   // add points to this user's total
                   if ($this->get('position') == 0) // new thread
                   {
                     $pointsModel = $this->getModelFromCache('xfPoints_Model_Currency');
                     $pointsEarned = $pointsModel->assignUserPoints($userId, 'thread');
                     $pointsModel->updateUserPoints($userId, $pointsEarned);
                   }
                 }
               }
           }
       }
     return parent::_postSaveAfterTransaction();
   }