本文整理汇总了PHP中Varien_Event_Observer::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getUser方法的具体用法?PHP Varien_Event_Observer::getUser怎么用?PHP Varien_Event_Observer::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_session_user_login_success
/**
* Event admin_session_user_login_success
*
* @param Varien_Event_Observer $event Event object
* @return void
*/
public function admin_session_user_login_success(Varien_Event_Observer $event)
{
$connection = Mage::getSingleton('core/resource')->getConnection('core_read');
$tableName = Mage::getSingleton('core/resource')->getTableName('admin/user');
$select = $connection->select()->from($tableName, 'default_backend_language')->where('user_id = ?', $event->getUser()->getId());
$localeCode = $connection->fetchOne($select);
if (false !== $localeCode) {
Mage::getSingleton('adminhtml/session')->setLocale($localeCode);
}
}
示例2: checkVersion
/**
* Checks if a update request is necessary and performs it if so.
*
* @param Varien_Event_Observer $observer
*/
public function checkVersion($observer)
{
$user = $observer->getUser();
$extra = unserialize($user->getExtra());
$lastCheck = Mage::getStoreConfig('payment/barzahlen/last_check');
if (isset($extra['configState']['payment_barzahlen']) && $extra['configState']['payment_barzahlen'] == 1) {
if ($lastCheck == null || $lastCheck < strtotime("-1 week")) {
$config = new Mage_Core_Model_Config();
$config->saveConfig('payment/barzahlen/last_check', time(), 'default', 0);
Mage::getConfig()->cleanCache();
$barzahlen = Mage::getSingleton('barzahlen/barzahlen');
$check = Mage::getSingleton('barzahlen/api_version');
$shopId = $barzahlen->getConfigData('shop_id') != null ? $barzahlen->getConfigData('shop_id') : $barzahlen->getConfigData('shop_id', 1);
if ($check->isNewVersionAvailable($shopId, 'Magento', Mage::getVersion(), (string) Mage::getConfig()->getNode()->modules->ZerebroInternet_Barzahlen->version)) {
Mage::getSingleton('core/session')->addNotice(sprintf(Mage::helper('barzahlen')->__('bz_adm_now_available'), $check->getNewPluginVersion(), $check->getNewPluginUrl()));
}
}
}
}
示例3: resetAttemptForBackend
/**
* Reset Attempts For Backend
*
* @param Varien_Event_Observer $observer
* @return Mage_Captcha_Model_Observer
*/
public function resetAttemptForBackend($observer)
{
return $this->_resetAttempt($observer->getUser()->getUsername());
}
示例4: adminSessionLoginSuccess
/**
* Log successful admin sign in
*
* @param Varien_Event_Observer $observer
*/
public function adminSessionLoginSuccess($observer)
{
$this->_logAdminLogin($observer->getUser()->getUsername(), $observer->getUser()->getId());
}
示例5: trackAdminSuccessfulLogin
/**
* Track admin user successful logins
*
* @param Varien_Event_Observer $observer
* @return null
*/
public function trackAdminSuccessfulLogin(Varien_Event_Observer $observer)
{
$helper = Mage::helper('totango');
$helper->log('Track successful admin user login');
if (!$helper->isEnabled()) {
return;
}
if ($helper->isTrackerEnabled('admin_login')) {
$adminUser = $observer->getUser();
$adminUsername = $adminUser->getUsername();
$excludedAdminUsers = array_flip($helper->getExcludedAdminUsers());
if (!isset($excludedAdminUsers[$adminUsername])) {
// New login is not counted in this event.
// So, this is a workaround for $adminUser->getLogDate()
$logDate = Mage::getModel('core/date')->date('Y-m-d H:i:s');
$helper->track(array('user-activity' => array('action' => 'AdminLogin', 'module' => 'Admin'), 'account-attribute' => array('Admin User Name' => $adminUser->getUsername(), 'Admin Last Login Time' => $logDate, 'Admin Login Number' => $adminUser->getLognum() + 1)));
} else {
$helper->log(array('message' => sprintf('Admin user "%s" is excluded from tracking', $adminUsername), 'level' => 5));
}
}
}