本文整理汇总了PHP中PhpFox::getUserBy方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpFox::getUserBy方法的具体用法?PHP PhpFox::getUserBy怎么用?PHP PhpFox::getUserBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpFox
的用法示例。
在下文中一共展示了PhpFox::getUserBy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runAchievement
/**
* Run a given achievement
*
* @param int $iId
*/
public function runAchievement($iId)
{
$aQuery = $this->database()->select('a._table, a.type, a.has_prefix, a.col_user, a.col_operator, a.col_value, a.built_query, a.activity_points, a.title, a.change_user_group, a.moderation_col_name, a.moderation_col_operator, a.moderation_col_value, u.item_id, g.change_id as upgrade_user_group')->from($this->_sTable, 'a')->leftjoin(Phpfox::getT('ko_achievements_user'), 'u', 'u.user_id = ' . Phpfox::getUserId() . ' AND u.achievement_id = a.achieve_id')->leftjoin(Phpfox::getT('ko_achievements_group_change'), 'g', 'g.achieve_id = a.achieve_id AND g.group_id = ' . PhpFox::getUserBy('user_group_id'))->where('a.achieve_id = ' . (int) $iId)->execute('getRow');
if (count($aQuery) == 0 || isset($aQuery['item_id'])) {
return false;
}
if ($aQuery['type'] == 1) {
$iCheck = $this->database()->select('COUNT(*)')->from($aQuery['has_prefix'] == 1 ? Phpfox::getT($aQuery['_table']) : $aQuery['_table'])->where($aQuery['col_user'] . ' = ' . Phpfox::getUserId() . ' AND ' . $aQuery['built_query'])->execute('getField');
} else {
$this->setUpWhere(Phpfox::getUserId(), $aQuery['col_user'], $aQuery['moderation_col_name'], $aQuery['moderation_col_operator'], $aQuery['moderation_col_value']);
$iCheck = $this->database()->select('COUNT(*)')->from($aQuery['has_prefix'] == 1 ? Phpfox::getT($aQuery['_table']) : $aQuery['_table'])->execute('getField');
if ($iCheck > 0) {
eval('$sIf = $iCheck' . $this->operator($aQuery['col_operator']) . $aQuery['col_value'] . ';');
if ($sIf === true) {
$iCheck = true;
} else {
$iCheck = false;
}
}
}
if ($iCheck) {
$iInsert = $this->database()->insert(Phpfox::getT('ko_achievements_user'), array('user_id' => Phpfox::getUserId(), 'achievement_id' => (int) $iId, 'time' => PHPFOX_TIME), true);
if ($aQuery['change_user_group'] > 0 && isset($aQuery['upgrade_user_group'])) {
Phpfox::getService('user.process')->updateUserGroup(Phpfox::getUserId(), $aQuery['change_user_group']);
}
if ($aQuery['activity_points'] > 0) {
$this->database()->update(Phpfox::getT('user_activity'), array('activity_achievements' => array('= activity_achievements +', 1), 'activity_total' => array('= activity_total +', 1), 'activity_points' => array('= activity_points +', $aQuery['activity_points'])), 'user_id = ' . Phpfox::getUserId());
}
/**
* Depreciated
if( Phpfox::isModule('notification') && Phpfox::getParam('achievements.send_notification') )
{
Phpfox::getService('notification.process')->add('achievements_new', (int) $iId, Phpfox::getUserId());
} */
if (Phpfox::isModule('feed') && Phpfox::getParam('achievements.on_feed')) {
Phpfox::getService('feed.process')->add('achievements', $iInsert);
}
if (Phpfox::getParam('achievements.send_email')) {
$oUrl = Phpfox::getLib('url');
$aFind = array('{urlLogin}', '{urlAchievement}', '{userName}', '{achievementName}');
$aReplace = array($oUrl->makeUrl('user.login'), $oUrl->makeUrl('achievements'), Phpfox::getUserBy('full_name'), $aQuery['title']);
$sSubject = str_replace($aFind, $aReplace, Phpfox::getParam('achievements.email_subject'));
$sMessage = str_replace($aFind, $aReplace, Phpfox::getParam('achievements.email_content'));
Phpfox::getLib('mail')->to(Phpfox::getUserId())->subject($sSubject)->message($sMessage)->notification('achievements.achievements')->send();
}
}
}