Cupara
Well-known member
Using _postSave() to add points to my xfpoints_currency field. The problem I am having is that when accessing it I have tried the following:
AND
Neither works, it returns a null value meaning it is not able to get any data from the database so $xfpoints_promotion_code and $this->get('xfpoints_promotion_code') are invalid and I'm unsure of the proper way to check custom fields against data I pull before awarding points.
PHP:
protected function _postSave()
{
$visitor = XenForo_Visitor::getInstance();
$promoModel = $this->_getPromotionModel();
$userField = XenForo_Model::create('XenForo_Model_UserField');
$values = $userField->getUserFieldValues($visitor['user_id']);
$xfpoints_promotion_code = $values['xfpoints_promotion_code'];
$promo = $promoModel->getCodeByCode($xfpoints_promotion_code));
if ($xfpoints_promotion_code == $promo['code'])
AND
PHP:
$promoModel = $this->_getPromotionModel();
$promo = $promoModel->getCodeByCode($this->get('xfpoints_promotion_code'));
if ($this->get('xfpoints_promotion_code') == $promo['code'])
Neither works, it returns a null value meaning it is not able to get any data from the database so $xfpoints_promotion_code and $this->get('xfpoints_promotion_code') are invalid and I'm unsure of the proper way to check custom fields against data I pull before awarding points.