MIXER
Member
Hello, in my mind I had found a problem with UserGroupPromotion system.
On my forum I have 1 promote condition and after runnig cron job XenForo_CronEntry_UserGroupPromotion:runPromotions I have problem, user are promoted to a new group, I watched it in his member profile in admin panel, and inserted new sql record in xf_user_group_promotion_log, but after running cron job again, this user are removes from a group and his record in xf_user_group_promotion_log deleted too.
I found bug in 292 line of library/XenForo/Model/UserGroupPromotion.php file. In my mind it has wrong logic with {} construction. I tested cron job with my change, and I guess it work correctly.
Plese check this:
Original version:
	
	
	
		
My version:
	
	
	
		
Please confirm this changes if it correct for your mind.
				
			On my forum I have 1 promote condition and after runnig cron job XenForo_CronEntry_UserGroupPromotion:runPromotions I have problem, user are promoted to a new group, I watched it in his member profile in admin panel, and inserted new sql record in xf_user_group_promotion_log, but after running cron job again, this user are removes from a group and his record in xf_user_group_promotion_log deleted too.
I found bug in 292 line of library/XenForo/Model/UserGroupPromotion.php file. In my mind it has wrong logic with {} construction. I tested cron job with my change, and I guess it work correctly.
Plese check this:
Original version:
		PHP:
	
	if (XenForo_Helper_Criteria::userMatchesCriteria($promotion['user_criteria'], false, $user))
            {
                if (!$hasPromotion)
                {
                    $this->promoteUser($promotion, $user['user_id']);
                    $changes++;
                }
            }
            else if ($hasPromotion)
            {
                $this->demoteUser($promotion, $user['user_id']);
                $changes++;
            }My version:
		PHP:
	
	if (XenForo_Helper_Criteria::userMatchesCriteria($promotion['user_criteria'], false, $user))
            {
                if (!$hasPromotion)
                {
                    $this->promoteUser($promotion, $user['user_id']);
                    $changes++;
                }
                else if ($hasPromotion)
                {
                    $this->demoteUser($promotion, $user['user_id']);
                    $changes++;
                }
            }Please confirm this changes if it correct for your mind.
 
 
		

 
 
		 
 
		 
 
		 
 
		 
 
		 
 
		