首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将UserFrosting与freichat集成

将UserFrosting与freichat集成
EN

Stack Overflow用户
提问于 2015-04-28 00:39:24
回答 1查看 374关注 0票数 0

您好,我正在尝试用FreiChat脚本实现UserFrosting脚本我已经实现了聊天,但在我想从UserFrosting传递用户id的时候,它似乎没有应用更改,因为它一直说我是访客,现在每个脚本都有它自己的数据库,我必须以某种方式将显示名称和用户id从UserFrosting传递到FreiChat。我已经尝试了这两个FreiChat的建议代码,即我必须通过执行以下操作来传递当前用户的用户id

代码语言:javascript
复制
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:

代码语言:javascript
复制
$loggedInUser->user_id

但是似乎不起作用,有没有人知道如何让它起作用?

EN

回答 1

Stack Overflow用户

发布于 2015-05-01 22:55:17

我没有用过FreiChat,但是你有没有试过修改他们建议的代码来使用UserFrosting的函数呢?类似于:

代码语言:javascript
复制
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
} 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29901414

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档