本文整理匯總了PHP中UserStatus::setUserId方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserStatus::setUserId方法的具體用法?PHP UserStatus::setUserId怎麽用?PHP UserStatus::setUserId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserStatus
的用法示例。
在下文中一共展示了UserStatus::setUserId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: update
function update()
{
$service = UserStatusService::getInstance();
$userId = OW::getUser()->getId();
if (empty($userId) || empty($_POST['status'])) {
exit('{}');
}
if (!($status = $service->findByUserId($userId))) {
$status = new UserStatus();
$status->setUserId($userId);
}
$statusContent = htmlspecialchars($_POST['status']);
$status->setStatus($statusContent);
$service->save($status);
if (OW::getPluginManager()->isPluginActive('activity') && trim($status->getStatus()) !== '') {
$action = new ACTIVITY_BOL_Action();
$data = array('string' => OW::getLanguage()->text('user_status', 'activity_string', array('actor' => BOL_UserService::getInstance()->getDisplayName($status->getUserId()), 'actorUrl' => BOL_UserService::getInstance()->getUserUrl($status->getUserId()), 'status' => $status->getStatus())), 'content_comment' => '');
$action->setUserId($status->getUserId())->setTimestamp(time())->setType('status-update')->setEntityId($status->getUserId())->setData($data);
ACTIVITY_BOL_Service::getInstance()->addAction($action);
}
exit(json_encode(array('result' => 'success', 'js' => 'OW.info("' . OW::getLanguage()->text('user_status', 'updated') . '")')));
}