robustpaul
Member
Hi,
I'm working on a key redemption system, where users can input a key, and their account will be upgraded to a specific user upgrade.
Here's the API function that I'm trying to utilize:
	
	
	
		
After reading what Chris posted here, I was able to come up with this:
	
	
	
		
I was able to get $username to return the user id of the inputted username, but I'm perplexed as to what I'm supposed to put as $userUpgradeRecord. I have an upgrade ID of 17, would I use that as $userUpgradeRecord?
Regards,
				
			I'm working on a key redemption system, where users can input a key, and their account will be upgraded to a specific user upgrade.
Here's the API function that I'm trying to utilize:
		PHP:
	
	upgradeUser(integer $userId, array $upgrade, boolean $allowInsertUnpurchasable, integer | null $endDate) : integer | falseAfter reading what Chris posted here, I was able to come up with this:
		PHP:
	
	        $userUpgradeModel = XenForo_Model::create('XenForo_Model_UserUpgrade');
        $userUpgradeModel->upgradeUser($username, $userUpgradeRecord, true);I was able to get $username to return the user id of the inputted username, but I'm perplexed as to what I'm supposed to put as $userUpgradeRecord. I have an upgrade ID of 17, would I use that as $userUpgradeRecord?
Regards,
 
 
		 
 
		 
 
		 
 
		