本文整理汇总了PHP中SJB_System::setCurrentUserInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP SJB_System::setCurrentUserInfo方法的具体用法?PHP SJB_System::setCurrentUserInfo怎么用?PHP SJB_System::setCurrentUserInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SJB_System
的用法示例。
在下文中一共展示了SJB_System::setCurrentUserInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$tp = SJB_System::getTemplateProcessor();
if (SJB_UserManager::isUserLoggedIn()) {
$user_id = SJB_UserManager::getCurrentUserSID();
$errors = array();
$id = SJB_Request::getInt('id', 0, 'GET');
$action = SJB_Request::getVar('action', '', 'GET');
if ($id > 0) {
// read message
if (SJB_PrivateMessage::isMyMessage($id)) {
if ($action == 'delete') {
SJB_PrivateMessage::delete(array($id));
SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/private-messages/inbox/');
}
$message = SJB_PrivateMessage::readMessage($id);
SJB_Authorization::updateCurrentUserSession();
$current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
$current_user_info['logged_in'] = true;
$current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
SJB_System::setCurrentUserInfo($current_user_info);
$tp->assign('message', $message);
$tp->assign('include', 'message_detail.tpl');
} else {
$errors['NOT_EXISTS_MESSAGE'] = 1;
}
}
$tp->assign('errors', $errors);
$tp->assign('unread', SJB_PrivateMessage::getCountUnreadMessages($user_id));
$tp->display('main.tpl');
} else {
$tp->assign('return_url', base64_encode(SJB_Navigator::getURIThis()));
$tp->display('../users/login.tpl');
}
}
示例2: execute
public function execute()
{
$current_user_info = array('logged_in' => false);
if (SJB_UserManager::isUserLoggedIn()) {
SJB_Authorization::updateCurrentUserSession();
$current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
$current_user_info['logged_in'] = true;
$current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
} else {
// social plugin
$userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
SJB_System::setCurrentUserGroupsInfo($userGroups);
SJB_Event::dispatch('Login_Plugin');
}
SJB_System::setCurrentUserInfo($current_user_info);
}