Home » Wap n Web » Cometchat on jcow
24 Feb 2011 01:24 By : admin ,



Klaten.tk - abt Script chat like facebook on footer page.
this sript just for jcow modif
step by step
(ga nyambung bgt pict sama topic post hehe..belajar ketik english dah)

There are several step to integrate cometchat

1. Cometchat standalone script - http://www.cometchat.com
2. Configure the integration file
3. add code on default theme
4. Create user session
5. Install the cometchat database
6. Configure the cometchat admin

Step 1
upload cometchat folder, default folder is cometchat. you can change this default folder to another name, but the default directory must be change in config.php

in config.php change the cometchat to your new folder name, if you use the default name just put cometchat

Code:
/* BASE URL START */
define('BASE_URL','/cometchat/');
/* BASE URL END */


Step 2
configure database file in integration.php
connect commetchat with your jcow database:

Code:

define('DB_SERVER','localhost');
define('DB_PORT','3306');
define('DB_USERNAME','yourdbusername');
define('DB_PASSWORD','yourdbpassword');
define('DB_NAME','yourdbname');
define('TABLE_PREFIX','jcow_');
define('DB_USERTABLE','accounts');
define('DB_USERTABLE_NAME','username');
define('DB_USERTABLE_USERID','id');
define('DB_USERTABLE_LASTACTIVITY','lastact');


replace the default function, so that user can be seen online :


Code:

function getUserID() {
$userid = 0;

if (!empty($_SESSION['userid'])) {
$userid = $_SESSION['userid'];
}
return $userid;
}


Code:

function getFriendsList($userid,$time) {
$sql = ("select DISTINCT ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." userid,
".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." username,
".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_LASTACTIVITY." lastactivity,
".TABLE_PREFIX.DB_USERTABLE.".avatar avatar, ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_NAME." link,
cometchat_status.message, cometchat_status.status
from ".TABLE_PREFIX."friends join ".TABLE_PREFIX.DB_USERTABLE."
on ".TABLE_PREFIX."friends.fid = ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID."
left join cometchat_status on ".TABLE_PREFIX.DB_USERTABLE.".".DB_USERTABLE_USERID." = cometchat_status.userid
where ".TABLE_PREFIX."friends.uid = '".mysql_real_escape_string($userid)."'
order by username asc";);
return $sql;
}


Code:

function getLink($link) {
return 'u/'.$link;

}


Code:

function getAvatar($image) {
if (is_file($_SERVER['DOCUMENT_ROOT'].'/uploads/avatars/'.$image)) {
return '/uploads/avatars/'.$image;
}
else {
return '/uploads/avatars/s_undefined.jpg';
}
}


Step 3
go to page.tpl.php..
put this on tag
Code:
<link type="text/css" href="<?php echo $uhome;?>/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8">


also this one..
Code:
<script type="text/javascript" src="<?php echo $uhome;?>/cometchat/cometchatjs.php" charset="utf-8"></script>


Step 4
put user session on user login and logout function ...
in includes/libs/ and find this in
member.module.php

find:
in login function

Code:

$_SESSION['uid'] = $row['id'];
below it and add this line:
Code
$_SESSION['userid'] = $row['id'];


also find this:
in logout function

Code:

$_SESSION['uid'] = 0;
below it and add this line:


Code:

$_SESSION['userid']= 0;


Step 5
install cometchat database through this link
http://yourdomain.com/yourcometchatdirectory/install.php

and then configure the cometchat admin through this link
http://yourdomain.com/yourcometchatdirectory/admin/index.php
the default username and password as follow
username : cometchat
password :cometchat

is all ok you will get cometchat bar display on you site.

if there are problems, please visit this link (cometchat installation)
installation guide from cometchat.com
http://www.cometchat.com/knowledgebase/installation/install-cometchat-with-standalone

Download on : http://www.siip.tk/182

this script just modif for jcow


Share: |
Short URL: http://klaten.tk/150
Comment (4)
wahyu memposting...
Mampir Gann http://salingcela.co.cc
Admin memposting...
iklan yg mana btudz..?? header blog ini apa di jcow nya..??
_____________
administrator
btudz memposting...
mas,,bikin iklan di header gmna yah
yayun memposting...
Ni tutor wat sapa to? Bahasane kulon kabeh...ra mudeng aku. Kalo ga salah Jcow itu yg mirip sma facebuk kan ya...?
View All

Leave a Comment
Name* :
Url :
Comment*:
[BB Code] [Smiley]
Code*:
79 Online | Today: 10 visit | Total: 65535 visit