FreiChat related discussions

Got any problems? Then this is the best place for all your questions regarding FreiChat

632
8
thaGH05T posted Dec 2 '14 at 2:32 am

Having issues pulling avatars from somewhere other than the default Gravatar? Using a CMS such as Joomla! or WordPress? Then this tutorial is for you!

NOTE: Version at the time of this tutorial was 9.6

Introduction

The avatar integration process as explained by the Codologic team is a bit tricky for early coders such as myself. I had the basic concept which I pulled from HERE, but I couldnt find where in my driver file I was supposed to edit. So I started off editing the base.php driver file which caused me some headache. I recommend going to the above link to get familiar with the process before continuing, but I am going to try to make this idiot proof, so lets get started.

What You Need To Know

There are a few things that you need to know before we begin. The files that I refer to here as "driver" files are specific to your CMS. The driver file that we will create is not going to work for you if you do not have Kunena installed in Joomla!. So you will need to use some critical thinking while you do this. Everything that we use a relative path for is just that, relative, so you will need to know your own file hierarchy before continuing. last but not least; for gods sake don't just copy and paste the code here because it will likely break your chat.

Gather The Info

You will need a few pieces of information to create the driver file that will import your avatars for use in Freichat. The first thing you need is where in the world are you pulling your avatars. If you are using Joomla! as a CMS and a forum such as Kunena then you can easily grab them by going to /media/kunena/avatars/users. If you are using another CMS or different forum etc. then you may need to look around a bit to find the path of your users avatars. In that path you will notice that the names of the given avatars are user specific. In this case it uses their ID in the file name. write down the path and set this aside.

We now need to find out how it is stored in the forum database. Is it a relative path or a full link? To do this, go to your database and search for your forum's users table. For Kunena it will be something like jos_kunena_users. if you look at a record in that table you will see a column named something similar to "avatar". Take not of what is in that field for a user. In my case each users value for avatar was users/avatar(ID).png. So we now know that we will have to call the avatar from the jos_kunena_users table from the avatar column with a relative path of /media/kunena/avatars/. Let me digress a bit. Kunena has smaller avatars for each user in a different folder path like: media/kunena/avatars/resized/size36/. If your forum has an option to use resized images I suggest you use them because it cuts down on page load time. The image will be fitted to the size used by Freichat anyways.

We need to check a few global variables at this point. Head over to file/path/to/freichat/hardcode.php and look at the last line.

$avatar_field_name = 'avatar';

If your forum's user table uses "avatar" as its column name for the avatar path, then you are ok. If not, then you need to change this value to the column name of your forum's avatar column name. Kunena is already named avatar so no change needed for us here. You can go back to your database now and look in the frei_config table to determin if show_name column is set to either guest or user. This will determine which we will need to add in our driver file we are going to create.

Creating The Driver File

Now we need to start putting together the driver file. Open up your favorite editor (I use Notepad++) and create a file named whatever your forum software name is .php, so for me it would be Kunena.php Then we need to start writing a bit of code. start off with the code below.

<?php

require 'Joomla.php';

class Kunena extends Joomla {

    public function __construct($db) {
        //parent::__construct($db);
        $this->db = $db;
    }
}

Notice the "require 'Joomla.php';" part. You will need to replace this with the name of your current driver file. You can find this in hardcode.php. You also need to change line 5 to match the class associated with your driver. In my case it would be:

class Kunena extends Joomla {

But in your case you may need to change Joomla with the name of your driver file without the .php. I dont know what all the class-names are but you can always ask the Codologic creators. Then you will need to copy and past these three functions from base.php located in file/path/to/freichat/server/drivers

//------------------------------------------------------------------------------   
    public function avatar_url($res) {
        $murl = str_replace("server/freichat.php", "", $this->url);
        $avatar_url = $murl . 'client/jquery/user.jpeg';
        return $avatar_url;
    }

//------------------------------------------------------------------------------   
    public function get_guests() {

        $query = "SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room
                   FROM frei_session
                  WHERE time>" . $this->online_time2 . "
                   AND session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                   AND status<>2
                   AND status<>0";
//echo $query;

        $list = $this->db->query($query)->fetchAll();
        return $list;
    }

//------------------------------------------------------------------------------ 
    public function get_users() {

        $query = "SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room
                   FROM frei_session
                  WHERE time>" . $this->online_time2 . "
                   AND session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                   AND guest=0
                   AND status<>2
                   AND status<>0";

        $list = $this->db->query($query)->fetchAll();

        return $list;
    }

//------------------------------------------------------------------------------

between the last two curly braces in the driver file you are creating. Now you should have:

<?php

require 'Joomla.php';

class Kunena extends Joomla {

    public function __construct($db) {
        //parent::__construct($db);
        $this->db = $db;
    }

 //------------------------------------------------------------------------------   
    public function avatar_url($res) {
        $murl = str_replace("server/freichat.php", "", $this->url);
        $avatar_url = $murl . 'client/jquery/user.jpeg';
        return $avatar_url;
    }

//------------------------------------------------------------------------------   
    public function get_guests() {

        $query = "SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room
                   FROM frei_session
                  WHERE time>" . $this->online_time2 . "
                   AND session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                   AND status<>2
                   AND status<>0";
//echo $query;

        $list = $this->db->query($query)->fetchAll();
        return $list;
    }

//------------------------------------------------------------------------------ 
    public function get_users() {

        $query = "SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room
                   FROM frei_session
                  WHERE time>" . $this->online_time2 . "
                   AND session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                   AND guest=0
                   AND status<>2
                   AND status<>0";

        $list = $this->db->query($query)->fetchAll();

        return $list;
    }

//------------------------------------------------------------------------------

}

So the three functions that we are going to work with, to reiterate, are avatar_url(), get_guests(), and get_users(). For avatar_url() we want to make the following changes. Make sure you use your relative path depending on your setup and not just copy mine.

$murl = str_replace($this->to_freichat_path, "", $this->url);
        $avatar_url = $murl . 'media/kunena/avatars/resized/size36/' . $res[$this->avatar_field_name];
        return $avatar_url;

That should replace the function, not be appended to it. Now for get_users() you need to change the query between the quotes to suite your needs which in my case looks like this now:

$query = "SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,k.avatar
                               FROM frei_session AS f
                               LEFT JOIN " . DBprefix . "kunena_users AS k ON f.session_id=k.userid
                              WHERE time>" . $this->online_time2 . "
                               AND f.session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                               AND f.status!=2
                               AND f.status!=0";

The difference here is we are adding ,k.avatar to the SELECT DISTINCT and adding a LEFT JOIN after the FROM statement. k.avatar is the field you will be pulling from the table, so if your column name was not avatar and you already changed the name in the hardcode.php file then set k.avatar to k.whatever your column name is. The way this LEFT JOIN works is kunena_users needs to be the table where your avatar path for your users lives, and f.session_id needs equal k.userid. In a bit more depth, we are trying to correlate the user from the frei_session table with the user in the jos_kunena_users table. and to do this we use the user ID of that user because it will match. After you do that and understand what you did, simply add the ,k.avatar and the LEFT JOIN statement to the get_users() function. The get_guests() and get_users() functions will look almost identical except for one AND statement will be added to get_users(). This is what makes this function unique because the AND statement makes the query return any record where f.guest is equal to 0.

Finish It Up

I know that was a lot to take in and you are waiting to be done with this but I assure you we are near the end. All you have to do now is save your new driver file and upload it to the drivers directory: file/path/to/freichat/server/drivers. and change your driver to the name of your file in hardcode.php, obviously leaving off the file extension. At that point just go back and refresh your site and check out your new avatars being pulled from wherever you chose to pull them from.

Example Driver File

Below is an example driver file which was named Kunena.php and in the hardcode.php the driver was changed to Kunena. I have added comments to let you know what exactly needs to be changed and why.

<?php

require 'Joomla.php'; // Needs to be the name of the CURRENT driver file you are using. You can find this is "path/to/freichat/hardcode.php"

class Kunena extends Joomla { // "Joomla" Needs to be whatever class you are extending from. Likely this will ALSO be the name of the old driver file as it is in this case.

    public function __construct($db) {
        //parent::__construct($db);
        $this->db = $db;
    }

//------------------------------------------------------------------------------
    public function avatar_url($res) {

        // Builds the avatar URL.
        $murl = str_replace($this->to_freichat_path, "", $this->url);
        $avatar_url = $murl . 'media/kunena/avatars/resized/size36/' . $res[$this->avatar_field_name]; // Needs to be the path to your avatar folder, relative or absolute. Take into account the path that is stored in your database as well.


        return $avatar_url;
    }

//------------------------------------------------------------------------------   
    public function get_guests() {

                                                                                                // Below we are adding ,k.avatar because the value "k" will be assigned as the table name and avatar is the field name in which the path to each users avatar is.
        // Queries the db and assigns it to $query.                                                // look at LEFT JOIN; you need to make sure that kunena_users is your table name where the avatars for your users live and also be sure the f.session can correlate to the k.userid to grab the correct avatar.
        $query = "SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,k.avatar 
                               FROM frei_session AS f
                               LEFT JOIN " . DBprefix . "kunena_users AS k ON f.session_id=k.userid
                              WHERE time>" . $this->online_time2 . "
                               AND f.session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                               AND f.status!=2
                               AND f.status!=0";
//echo $query;

        // Creates an array of everything the query asked for.
        $list = $this->db->query($query)->fetchAll();
        //Returns the array.
        return $list;
    }

//------------------------------------------------------------------------------ 
    public function get_users() {

        // Queries the db and assigns it to $query.                                                // Do the exact same thing as the get_guests() function. Don't copy and past because the AND statements are a bit different.
        $query = "SELECT DISTINCT f.status_mesg,f.username,f.session_id,f.status,f.guest,f.in_room,k.avatar
                               FROM frei_session AS f                               
                               LEFT JOIN " . DBprefix . "kunena_users AS k ON f.session_id=k.userid
                              WHERE time>" . $this->online_time2 . "
                               AND f.session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                               AND f.guest=0
                               AND f.status!=2
                               AND f.status!=0";
        // Creates an array of everything the query asked for.
        $list = $this->db->query($query)->fetchAll();
        //Returns the array.
        return $list;
    }

//------------------------------------------------------------------------------    

}
272
1
petepacific posted Sep 17 '15 at 10:46 am

I have purchased the Platinum suite of FreiChat - Great software by the way!

However, everything works fine on desktop but NOT on mobile/tablet. It seems it doesn't load (at all) on iOS or Android.

Is there anything else I need to set up before being able to provide it to our clients on mobile? I have pasted the required code snippet during installation below the </header> tag, but I am not sure if additional steps have to be taken for responsive versions of the theme?

And another question: Is my Platinum license to be renewed periodically? Because there is not much information on the site about that (as far as I can see).

Thanks!

174
2
Roadkingscot posted Sep 13 '15 at 5:49 pm

I've installed Freight on my server and confirmed that the correct code is in the header of my index file for my default theme. I can also log into the backend side of Freichat. It doesn't matter what location I select but I cannot get the Freichat component to display on my site.

My configuration is as follows;
PHP Built On Linux boscustweb5006.eigbox.net 3.14.27 #1 SMP Wed Dec 17 21:04:05 EST 2014 x86_64
Database Version 5.5.44-0ubuntu0.12.04.1-log
Database Collation
PHP Version 5.3.29
Web Server Apache/2
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.3.1 Stable [ Ember ] 11-June-2014 13:30 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12

I'm using the Pixeldot template, but Freichat doesn't appear to work with any of my templates.

When I installed the app I put it into a freichat subdirectory of my main website directory.

Can anyone please help, as I'd really like to get chat working on my site as soon as possible.

206
1

I've install freichat on apache 2.4, i use php 5.6.12 and mysql 5.6
the problems is freichat not displaying in browser(firefox last version)
there's an error message :
<br />
<b>Fatal error</b>: Call to a member function fetchAll() on boolean in <b>C:\Apache24\htdocs\custom\freichat\arg.php</b> on line <b>65</b><br />

Must I have to activate the PDO extensions?
I need help. Sorry for bad english
thanks smile

recent by admin  ·  Sep 7 '15 at 4:37 pm
269
5
jimmy posted Feb 15 '14 at 6:07 pm

Hi,

In this thread:
http://codologic.com/page/node/3363

Someone asked about high server CPU load. You said:
using Comet is better than short polling and has less load on server.


But in my FreiChat admin screen, these words are used:

Comet Cons:
more complex and more server resources used

Short Polling Pros:
not server consuming (only if the time between requests is long).


I am not an experienced web server guy, so I'm confused. You say that comet has less load on the server, but the admin screen says it has more server resources used.

My website is running on Ubuntu server 12.04 with Apache 2.2.22 and PHP 5.3.10, and our CMS is Joomla 3.2.x with Community Builder 1.9. FreiChat is working great with my 5 or 6 beta testers (I don't know if I can, or how I can, look at my server resources). We are migrating from an older site, where we have about 100 people online at most times. I don't know whether they will all use the chat feature at the same time or not. We have not had this type of feature before.

In this situation, which is better -- comet or short polling?

Thanks.
jimmy

205
5
templarart posted Aug 24 '15 at 6:54 pm

Hi! I've been using your chat for over a year now and it's working great. You've addressed all my previous issues but I've been getting a lot of complaints about one. I really need a sound in the General Chat room to show that someone said something - just like in regular private chats. My ops are telling me that this is the big problem that has changed our general chat from very active to almost completely dead. Thanks. smile

210
1

Hello,

We have acquired FreiChat to be used in our project and hoped that it would help us to achieve our goals. Though we paid for it, but we were unable neither to install nor to use it under Joomla 3 with Socialize template. We have applied to you several months ago but got no response. So, please help us to solve the problem ASAP.

81
0
irik posted Aug 19 '15 at 9:56 am

Hello,

We have acquired FreiChat to be used in our project and hoped that it would help us to achieve our goals. Though we paid for it, but we were unable neither to install nor to use it under Joomla 3 with Socialize template. We have applied to you several months ago but got no response. So, please help us to solve the problem ASAP.

285
4

hello ,
i was install frei-chat and all was fine i have the chat box in right corner downstair and i have the button group chat , what was possible to open , till i change the first colour of the smal chat box downstair the button group chat is disapear and i have now a small button in left corner very down in last place left side what have a cross but if i click is gone. my group chat is not possible to find and to open. the smal chat from user to user works very good but the group chta i cant find and open . who can help with a tip what i can do to fix the problem

thx for help

241
4

Hello,

First, thank for your extension, it works very well. smile

I use Joomla 3.4 and phpbb 3.4, both forked with P8Pbb Bridge.
The forum is also encapsuled in the Joomla template.

I installed freichat with phpbb integration (to have users avatars displaying correctly because I have no avatar system on Joomla), and I put the given code in overall_header.html as mentionned during the installation.

It works fine, my users are displayed correctly, and also the phpbb avatars.

But freichat is only displaying on forum pages, not on Joomla pages.
I try to put the given code in index.php of my joomla template rather than in overall_header.html, but it don't work.

Is there a possibility to display the chat module in all my website pages (Joomla and phpbb) by changing something in the code ?

The code is the following :

<!--===========================FreiChatX=======START=========================-->
<!--    For uninstalling ME , first remove/comment all FreiChatX related code i.e below code
     Then remove FreiChatX tables frei_session & frei_chat if necessary
         The best/recommended way is using the module for installation                         -->

<!-- PHP -->
if(!function_exists("freichatx_get_hash")){
function freichatx_get_hash(){
global $user;
$ses = $user->session_id;
       if(is_file("/home/xxx/www/freichat/hardcode.php")){
               require "/home/xxx/www/freichat/hardcode.php";
               $temp_id =  $ses . $uid;
               return md5($temp_id);
       }
       else
       {
               echo "<script>alert('module freichatx says: hardcode.php file not
found!');</script>";
       }
       return 0;
}
}
<!-- ENDPHP -->
<script type="text/javascript" language="javascipt"
src="http://www.xxx.fr/freichat/client/main.php?id={SESSION_ID}&xhash=<!-- PHP --> echo freichatx_get_hash(); <!-- ENDPHP -->">
</script><link rel="stylesheet" href="http://www.xxx.fr/freichat/client/jquery/freichat_themes/freichatcss.php" type="text/css">
<!--===========================FreiChatX=======END=========================-->

I tried to install Freichat with Joomla integration, but the random avatars displayed are not those of phpbb, so I have choose phpbb integration instead. smile

Thank for your help.

Bye.

recent by bendeb  ·  Jul 27 '15 at 11:10 pm
155
4

Hello,

I encountered a problem with Freichat and phpbb.
Freichat works good, no problem.

I'm administrator of my forum (with full permissions) but since I installed Freichat (with phpbb integration), when I try to delete a post in a topic, phpbb say me that I haven't the permissions to delete posts in this forum. O_o

I can edit posts, close topic, delete topic, but I can't delete a post in a topic.

If I disable Freichat (by removing the code in overall_header.html), I can delete posts again.

I use p8pbb, a Joomla component that bridge phpbb and Joomla.
I think the problem is caused by this component redirections, so maybe a simple modification will correct this bug but the developper dont want to do anything with tierce mods/extensions.

I can give you an FTP and Joomla admin access.

Thank for your help smile

recent by bendeb  ·  Jul 27 '15 at 11:07 pm
389
14

I have Community builder installed and i want to use Freichat to show a list off contacts for a use on the right side of the screen just like facebook does alog with their information of if they are online , Offline , their names and a chat link to chat with the on clicking from there , how do i achieve this with Freichat ?

Thanks
Pranay

99
1

At first I had a issue with pdo_msql but managed to resolve that, then the chat installed apparently without any problem.

Its installed on Joomla 3.x with the latests CB both are up to date since are fresh installs.

I downloaded the Module, published it on all pages in a visible location. I don't see anything on the client side.

In the server side, I can't see any Server or Client settings nor can I create chat rooms. The chat rooms don't show in the list when I try adding them!

Is another thing I'm wandering so I did make sure it selected the correct database! Is I am running Joomla 2.x site on the Domain and this Joomla CB site on a sub domain. Friechat is installed in the root of the Sub Domain.

Just was wandering if since their are two instances of Joomla could it be throwing something off? Like try trying to put the chat on the Domain instead of the Sub Domain. I may try and install the module there and see if something happens?

346
8
paolspo posted Jul 11 '15 at 11:05 am

nothing works, I bought the 165$ version and not work, too many trouble and they even not return me the money. So use the free version, if you have time to spend up, cause it takes time to fix all the problems. Do not buy anything of these products, work poorly.
I thought about buying the most 'expensive' cause I thought sure it has to work, but not working.
They have also started to delete my posts.
I asked them to send me some sites of people who have bought my same version, cause I wanted to see how it works, but they don't give any answer. I see a beautiful testimonial page, but I do not see any link that really testifies. Therefore be careful to send them money.

1.31k
6.08k
20
Actions
Hide topic messages
Enable infinite scrolling
Previous
1 ... 891011121314 ... 66
Next
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft