本文整理汇总了PHP中XenForo_Visitor::getVisitorSetupOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Visitor::getVisitorSetupOptions方法的具体用法?PHP XenForo_Visitor::getVisitorSetupOptions怎么用?PHP XenForo_Visitor::getVisitorSetupOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Visitor
的用法示例。
在下文中一共展示了XenForo_Visitor::getVisitorSetupOptions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _executePromotionUpdate
protected function _executePromotionUpdate($force = false)
{
if (!XenForo_Application::isRegistered('session') || XenForo_Application::getSession()->get('promotionChecked')) {
return;
}
$visitor = XenForo_Visitor::getInstance();
if (!$visitor['user_id'] || $visitor['last_activity'] > XenForo_Application::$time - 1800 && !$force) {
// guest or we've been active recently, so let the cron do it
return;
}
XenForo_Application::getSession()->set('promotionChecked', true);
/** @var $promotionModel XenForo_Model_UserGroupPromotion */
$promotionModel = $this->getModelFromCache('XenForo_Model_UserGroupPromotion');
if ($promotionModel->updatePromotionsForUser($visitor->toArray())) {
// awarded promotions, reload
XenForo_Visitor::setup($visitor['user_id'], XenForo_Visitor::getVisitorSetupOptions());
}
}
示例2: _postSaveAfterTransaction
protected function _postSaveAfterTransaction()
{
parent::_postSaveAfterTransaction();
if (SV_UserPromoOnUpdate_Globals::$RunPromotion) {
// ensure we don't attempt to run the promotion twice in the same request
SV_UserPromoOnUpdate_Globals::$RunPromotion = false;
$user = $this->getMergedData();
/** @var $promotionModel XenForo_Model_UserGroupPromotion */
$promotionModel = $this->getModelFromCache('XenForo_Model_UserGroupPromotion');
if ($promotionModel->updatePromotionsForUser($user)) {
$visitor = XenForo_Visitor::getInstance();
// awarded promotions, reload session
if (XenForo_Application::isRegistered('session') && $visitor['user_id'] && $visitor['user_id'] == $user['user_id']) {
XenForo_Application::getSession()->set('promotionChecked', true);
XenForo_Visitor::setup($user['user_id'], XenForo_Visitor::getVisitorSetupOptions());
}
}
}
}