General discussion
CB field near the user name

hi, there is a way to show a CB field (like gender or country) near the username in the freichat online user list?(a tooltip on the avatar like facebook would be even better)
i know i need some php code to do that, so could u tell me what file should i study for this "hack"?

hi, there is a way to show a CB field (like gender or country) near the username in the freichat online user list?(a tooltip on the avatar like facebook would be even better) i know i need some php code to do that, so could u tell me what file should i study for this "hack"?

Hi,

You need to first get the required data from the database. This will include modifying the queries in freichat/server/drivers/JCB.php

You need to edit the queries in get_guests(), get_users(), get_buddies() .

There are two more steps after this . Are you able to edit the queries ?

Hi, You need to first get the required data from the database. This will include modifying the queries in freichat/server/drivers/JCB.php You need to edit the queries in get_guests(), get_users(), get_buddies() . There are two more steps after this . Are you able to edit the queries ?
Necessity is the mother of all inventions!

hi, i saw the queries, i guess i just have to select cb_country too.

and how can i add the country below the name in freichat user list?

hi, i saw the queries, i guess i just have to select cb_country too. and how can i add the country below the name in freichat user list?

Sorry for the late reply .

In which table is the cb_country stored ?

You need to make a LEFT JOIN in the sql query with the table .

Post the query if you have made any changes

Sorry for the late reply . In which table is the cb_country stored ? You need to make a LEFT JOIN in the sql query with the table . Post the query if you have made any changes
Necessity is the mother of all inventions!

this is now get_guests() query, i don't need the left join, comprofiler table is already joined

SELECT DISTINCT f.status_mesg,j.avatar,f.username,f.session_id,f.status,f.guest,u.username AS profile_iden,f.in_room,j.cb_country
FROM frei_session AS f
LEFT JOIN " . DBprefix . "comprofiler AS j ON j.id=f.session_id
LEFT JOIN " . DBprefix . "users AS u ON u.id=f.session_id

WHERE
f.time>" . $this->online_time2 . "
AND f.session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . "
AND f.status2
AND f.status0";

this is now get_guests() query, i don't need the left join, comprofiler table is already joined <code> SELECT DISTINCT f.status_mesg,j.avatar,f.username,f.session_id,f.status,f.guest,u.username AS profile_iden,f.in_room,j.cb_country FROM frei_session AS f LEFT JOIN " . DBprefix . "comprofiler AS j ON j.id=f.session_id LEFT JOIN " . DBprefix . "users AS u ON u.id=f.session_id WHERE f.time>" . $this->online_time2 . " AND f.session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . " AND f.status<>2 AND f.status<>0";</code>

You have to now send this data (country) in the response .

Open freichat/server/freichat.php

Around line 426 , replace

$freichat->userdata[] = array(
"username" => $guest,
"userid" => $res['session_id'],
"avatar" => $avatar_url,
"img_url" => $img_url,
"show_name" => $show_name,
"status_mesg" => $res['status_mesg'],
"profile_link" => $profile_link,
);


with

$freichat->userdata[] = array(
"username" => $guest,
"userid" => $res['session_id'],
"avatar" => $avatar_url,
"img_url" => $img_url,
"show_name" => $show_name,
"status_mesg" => $res['status_mesg'],
"profile_link" => $profile_link,
"country" => $res['cb_country']
);


Now, open freichat/client/freichat.js

Around line 1145 , go to FreiChat.create_users()
You need to edit the variable users_html as required .
Your country name is stored in userdata[users_len].country

You have to now send this data (country) in the response . Open freichat/server/freichat.php Around line 426 , replace <code> $freichat->userdata[] = array( "username" => $guest, "userid" => $res['session_id'], "avatar" => $avatar_url, "img_url" => $img_url, "show_name" => $show_name, "status_mesg" => $res['status_mesg'], "profile_link" => $profile_link, ); </code> with <code> $freichat->userdata[] = array( "username" => $guest, "userid" => $res['session_id'], "avatar" => $avatar_url, "img_url" => $img_url, "show_name" => $show_name, "status_mesg" => $res['status_mesg'], "profile_link" => $profile_link, "country" => $res['cb_country'] ); </code> Now, open freichat/client/freichat.js Around line 1145 , go to FreiChat.create_users() You need to edit the variable <u>users_html</u> as required . Your country name is stored in <u>userdata[users_len].country</u>
Necessity is the mother of all inventions!

thanks, now i just have to manage the "null" case, if a user not set the country it shouldn't print "null" :)

thanks, now i just have to manage the "null" case, if a user not set the country it shouldn't print "null" :)
102
8
0
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft