您好,我正在尝试用FreiChat脚本实现UserFrosting脚本我已经实现了聊天,但在我想从UserFrosting传递用户id的时候,它似乎没有应用更改,因为它一直说我是访客,现在每个脚本都有它自己的数据库,我必须以某种方式将显示名称和用户id从UserFrosting传递到FreiChat。我已经尝试了这两个FreiChat的建议代码,即我必须通过执行以下操作来传递当前用户的用户id
if(USER_IS_LOGGED_IN)
{
$ses = LOGGED_IN_USERID; //tell freichat the userid of the current user
setcookie("freichat_user", "LOGGED_IN", time()+3600, "/"); // *do not change -> freichat code
}
else {
$ses = null; //tell freichat that the current user is a guest
setcookie("freichat_user", null, time()+3600, "/"); // *do not change -> freichat code
} 我可以像这样传递来自用户霜的user_id:
$loggedInUser->user_id但是似乎不起作用,有没有人知道如何让它起作用?
发布于 2015-05-01 22:55:17
我没有用过FreiChat,但是你有没有试过修改他们建议的代码来使用UserFrosting的函数呢?类似于:
if(isUserLoggedIn()) // isUserLoggedIn is UF's function to check whether or not a user is logged in
{
$ses = $loggedInUser->user_id; //tell freichat the userid of the current user
setcookie("freichat_user", "LOGGED_IN", time()+3600, "/"); // *do not change -> freichat code
}
else {
$ses = null; //tell freichat that the current user is a guest
setcookie("freichat_user", null, time()+3600, "/"); // *do not change -> freichat code
} https://stackoverflow.com/questions/29901414
复制相似问题