Bill.D
Active member
Hey All,
My problem with CometChat was Finaly resolved and I just wanted to share what they & I did.
Here is the code from the integration.php that they changed:
Here is the Template change I added to PAGE_CONTAINER:
Note: the Script where the userid variable is declared and then set to the cookie
If anyone thinks of a better way this all should be done.. Let me know
My problem with CometChat was Finaly resolved and I just wanted to share what they & I did.
Here is the code from the integration.php that they changed:
PHP:
function getUserID() {
$userid = 0;
if (!empty($_SESSION['basedata']) && $_SESSION['basedata'] != 'null') {
$_REQUEST['basedata'] = $_SESSION['basedata'];
}
if (!empty($_REQUEST['basedata'])) {
/*if (function_exists('mcrypt_encrypt')) {
$key = KEY_A.KEY_B.KEY_C;
$uid = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($_REQUEST['basedata']), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
if (intval($uid) > 0) {
$userid = $uid;
}
} else {*/
$userid = $_REQUEST['basedata'];
//}
}
if (!empty($_COOKIE['xf_session'])) {
$sql = ("SELECT `session_data` FROM `".TABLE_PREFIX."session` WHERE `session_id` = '".$_COOKIE['xf_session']."'"); $query = mysql_query($sql);
$sess2 = mysql_fetch_array($query);
$sess3 = unserialize($sess2[0]);
$userid = $sess3['user_id'];
} $userid = intval($userid);
if (!empty($_COOKIE['xf_user'])) {
$a = explode(',',$_COOKIE['xf_user']);
$userid = $a[0];
}
/*
if (!empty($_COOKIE['xf_session'])) {
$sql = ("SELECT `session_data` FROM `".TABLE_PREFIX."session` WHERE `session_id` = '".$_COOKIE['xf_session']."'"); $query = mysql_query($sql);
$sess2 = mysql_fetch_array($query);
$sess3 = unserialize($sess2[0]);
$userid = $sess3['user_id'];
}*/
//echo $userid;
return $userid;
}
Here is the Template change I added to PAGE_CONTAINER:
PHP:
<html id="XenForo" lang="{$visitorLanguage.language_code}" dir="{$visitorLanguage.text_direction}" class="Public {xen:if {$visitor.user_id}, 'LoggedIn', 'LoggedOut'} {xen:if {$sidebar}, 'Sidebar', 'NoSidebar'} {xen:if $hasAutoDeferred, RunDeferred} {xen:if $isResponsive, Responsive, NoResponsive}" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<!--- CometChat 5.1.0 START --->
<script type="text/javascript">
var userid = {$visitor.user_id};
document.cookie = "xf_user="+userid;
</script>
<link type="text/css" href="http://XXX.XXXXXXX.com/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">
<script type="text/javascript" src="http://XXX.XXXXXXX.com/cometchat/cometchatjs.php" charset="utf-8"></script>
<!--- CometChat 5.1.0 END --->
<xen:hook name="page_container_head">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
Note: the Script where the userid variable is declared and then set to the cookie
If anyone thinks of a better way this all should be done.. Let me know