【问题标题】:Integrating UserFrosting with freichat将 UserFrosting 与 freichat 集成
【发布时间】:2016-06-21 04:10:08
【问题描述】:

嗨,所以我正在尝试使用 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

但似乎不起作用,有人知道如何使它起作用吗?

【问题讨论】:

    标签: php session authentication cookies userfrosting


    【解决方案1】:

    我没有使用过 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
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-28
      • 1970-01-01
      • 2019-05-30
      • 2016-04-10
      • 2016-10-26
      • 2016-10-22
      • 2017-05-16
      相关资源
      最近更新 更多