FreiChat related discussions
Freichat pulling Kunena avatars?

I have tried integrating Kunena avatars with Freichat but its not working. The error log shows that the sessions are being created but I don't see sessions in the sessions table. so the log is no help. I used instructions from here and modified some of the code to fit with the new version of Freichat as it uses a base driver. http://codologic.com/page/node/45 And yes I did create the avatar column in the sessions table of the database. I read somewhere else that there are some unnecessary steps but it should work. What I want to know is with the current paid version of Freichat does this method work and if not how can I make this happen exactly? Yes, I have read the wiki you guys have produced and am a bit unclear. From the wiki I have modified the query to pull the Kunena avatar but I have no clue where to put the query... I am using Joomla! 3.3.6

I have tried integrating Kunena avatars with Freichat but its not working. The error log shows that the sessions are being created but I don't see sessions in the sessions table. so the log is no help. I used instructions from here and modified some of the code to fit with the new version of Freichat as it uses a base driver. http://codologic.com/page/node/45 And yes I did create the avatar column in the sessions table of the database. I read somewhere else that there are some unnecessary steps but it should work. What I want to know is with the current paid version of Freichat does this method work and if not how can I make this happen exactly? Yes, I have read the wiki you guys have produced and am a bit unclear. From the wiki I have modified the query to pull the Kunena avatar but I have no clue where to put the query... I am using Joomla! 3.3.6

Happy Hunting...

Here is the tail of my log after I made a small change to a mistake I had made. This time there was a session created in the table BUT if I open another browser such as FF or IE or even an incognito window in chrome the userlist sticks on "getting list of online users."

November 26, 2014, 10:12 am: Inserted the user with the following data :: Username = And ID = Default status = I am available

November 26, 2014, 10:13 am: main.php loaded

November 26, 2014, 10:13 am: Inserted the user with the following data :: Username = Guest-aa37 And ID = 1417406311 Default status = I am available

November 26, 2014, 10:20 am: main.php loaded

November 26, 2014, 10:20 am: Inserted the user with the following data :: Username = Guest-1pau And ID = 1417148750 Default status = I am available

November 26, 2014, 10:27 am: main.php loaded

November 26, 2014, 10:27 am: Incorrect Query : SELECT DISTINCT u.username,j.userid,j.guest,jos_kunena_users.avatar
FROM jos_session AS j
LEFT JOIN jos_users AS u ON j.userid=u.id
LEFT JOIN jos_kunena_users ON jos_kunena_users.userid=u.id
WHERE j.session_id=?
AND j.client_id=0 LIMIT 1
session id: 1a8cb451ae6fffa704f1e8d6460875a3
PDO error: Array
(
[0] => 00000
[1] =>
[2] =>
)

November 26, 2014, 10:27 am: Inserted the user with the following data :: Username = And ID = Default status = I am available

November 26, 2014, 10:27 am: main.php loaded

November 26, 2014, 10:27 am: Inserted the user with the following data :: Username = Guest-1pqh And ID = 1417422657 Default status = I am available

November 26, 2014, 10:30 am: main.php loaded

November 26, 2014, 10:30 am: Inserted the user with the following data :: Username = thaGH05T And ID = 524 Default status = I am available

November 26, 2014, 10:30 am: main.php loaded

November 26, 2014, 10:30 am: Inserted the user with the following data :: Username = Guest-aaw And ID = 1417458982 Default status = I am available

November 26, 2014, 10:30 am: main.php loaded

November 26, 2014, 10:30 am: Inserted the user with the following data :: Username = Guest-1pnr And ID = 1417359643 Default status = I am available

Here is the tail of my log after I made a small change to a mistake I had made. This time there was a session created in the table BUT if I open another browser such as FF or IE or even an incognito window in chrome the userlist sticks on "getting list of online users." November 26, 2014, 10:12 am: Inserted the user with the following data :: Username = And ID = Default status = I am available November 26, 2014, 10:13 am: main.php loaded November 26, 2014, 10:13 am: Inserted the user with the following data :: Username = Guest-aa37 And ID = 1417406311 Default status = I am available November 26, 2014, 10:20 am: main.php loaded November 26, 2014, 10:20 am: Inserted the user with the following data :: Username = Guest-1pau And ID = 1417148750 Default status = I am available November 26, 2014, 10:27 am: main.php loaded November 26, 2014, 10:27 am: Incorrect Query : SELECT DISTINCT u.username,j.userid,j.guest,jos_kunena_users.avatar FROM jos_session AS j LEFT JOIN jos_users AS u ON j.userid=u.id LEFT JOIN jos_kunena_users ON jos_kunena_users.userid=u.id WHERE j.session_id=? AND j.client_id=0 LIMIT 1 session id: 1a8cb451ae6fffa704f1e8d6460875a3 PDO error: Array ( [0] => 00000 [1] => [2] => ) November 26, 2014, 10:27 am: Inserted the user with the following data :: Username = And ID = Default status = I am available November 26, 2014, 10:27 am: main.php loaded November 26, 2014, 10:27 am: Inserted the user with the following data :: Username = Guest-1pqh And ID = 1417422657 Default status = I am available November 26, 2014, 10:30 am: main.php loaded November 26, 2014, 10:30 am: Inserted the user with the following data :: Username = thaGH05T And ID = 524 Default status = I am available November 26, 2014, 10:30 am: main.php loaded November 26, 2014, 10:30 am: Inserted the user with the following data :: Username = Guest-aaw And ID = 1417458982 Default status = I am available November 26, 2014, 10:30 am: main.php loaded November 26, 2014, 10:30 am: Inserted the user with the following data :: Username = Guest-1pnr And ID = 1417359643 Default status = I am available

Happy Hunting...

I tried logging off and logging back in but no guest session was created only the initial session.

I tried logging off and logging back in but no guest session was created only the initial session.

Happy Hunting...

OK I have reverted back to the default settings and then tried a different approach.

//------------------------------------------------------------------------------   
    //public function avatar_url($avatar) { 
        //$murl = "https://ghostlyhaks.com/media/kunena/avatars/";
        //$avatar_url = $murl . $avatar;

   // return $avatar_url;

    //}

    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,X.avatar
                    FROM frei_session , jos_kunena_users AS X
                    WHERE time>" . $this->online_time2 . "
                    AND session_id<>" . $_SESSION[$this->uid . 'usr_ses_id'] . "
                    AND status<>2
                    AND status<>0
                    AND X.userid = session_id";

//echo $query;

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

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

This is in the base.php driver file. This seems to be the ONLY place that has the functioned mentioned in the documentation. I think the problem I have now is with the avatar URL do I need to somehow iterate through each instance in the array? Please help with this as soon as possible.

OK I have reverted back to the default settings and then tried a different approach. ```` //------------------------------------------------------------------------------ //public function avatar_url($avatar) { //$murl = &amp;quot;https://ghostlyhaks.com/media/kunena/avatars/&amp;quot;; //$avatar_url = $murl . $avatar; // return $avatar_url; //} public function avatar_url($res) { $murl = str_replace(&amp;quot;server/freichat.php&amp;quot;, &amp;quot;&amp;quot;, $this-&amp;gt;url); $avatar_url = $murl . &#039;client/jquery/user.jpeg&#039;; return $avatar_url; } //------------------------------------------------------------------------------ public function get_guests() { $query = &amp;quot;SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room,X.avatar FROM frei_session , jos_kunena_users AS X WHERE time&amp;gt;&amp;quot; . $this-&amp;gt;online_time2 . &amp;quot; AND session_id&amp;lt;&amp;gt;&amp;quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &amp;quot; AND status&amp;lt;&amp;gt;2 AND status&amp;lt;&amp;gt;0 AND X.userid = session_id&amp;quot;; //echo $query; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ ```` This is in the base.php driver file. This seems to be the ONLY place that has the functioned mentioned in the documentation. I think the problem I have now is with the avatar URL do I need to somehow iterate through each instance in the array? Please help with this as soon as possible.

Happy Hunting...

do not alter the base.php file, make the changes in Joomla.php which overrides the methods in base.php
and you do not have to iterate every instance because avatar_url() method is called automatically for each user.

do not alter the base.php file, make the changes in Joomla.php which overrides the methods in base.php and you do not have to iterate every instance because avatar_url() method is called automatically for each user.
Necessity is the mother of all inventions!

Ok I can try that but where in the joomla driver file am I suppose to make the chang? Or am I suppose to rewrite the above into it? An example using the above would be truly helpful.

Ok I can try that but where in the joomla driver file am I suppose to make the chang? Or am I suppose to rewrite the above into it? An example using the above would be truly helpful.

Happy Hunting...

the file is located: freichat/server/drivers/Joomla.php
just edit this file accordingly.

the file is located: `freichat/server/drivers/Joomla.php` just edit this file accordingly.
Necessity is the mother of all inventions!

Yes I know exactly where the file is located. I am asking where I need to edit or more specifically what lines would really help. And is the code above what needs to be in that file.

Yes I know exactly where the file is located. I am asking where I need to edit or more specifically what lines would really help. And is the code above what needs to be in that file.

Happy Hunting...

Hi,

We have created a Kunena driver for you.

Download the Kunena.php.zip driver, and upload the Kunena.php file to freichat/server/drivers folder.

Now, go to freichat/hardcode.php and replace

$driver='Joomla'; //Integration driver

with

$driver='Kunena'; //Integration driver
Hi, We have created a Kunena driver for you. Download the [Kunena.php.zip](serve/attachment&amp;amp;path=5479bca48a0b7.zip) driver, and upload the `Kunena.php` file to freichat/server/drivers folder. Now, go to freichat/hardcode.php and replace ``` $driver=&#039;Joomla&#039;; //Integration driver ``` with ``` $driver=&#039;Kunena&#039;; //Integration driver ```
Necessity is the mother of all inventions!

The above link does not work it downloads an index.php file that is surely not php. Can you please post another link or drop the code right here?

The above link does not work it downloads an index.php file that is surely not php. Can you please post another link or drop the code right here?

Happy Hunting...

The above link will download a file named 'index.zip' that has 'Kunena.php' file.

Here is the code for Kunena.php file:

<?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($this->to_freichat_path, "", $this->url);
        $avatar_url = $murl . 'media/kunena/avatars/resized/size36/' . $res[$this->avatar_field_name];
        return $avatar_url;
    }

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

        $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;

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

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

        $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";

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

        return $list;
    }

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

}
The above link will download a file named &#039;index.zip&#039; that has &#039;Kunena.php&#039; file. Here is the code for Kunena.php file: ``` &amp;lt;?php require &#039;Joomla.php&#039;; class Kunena extends Joomla { public function __construct($db) { //parent::__construct($db); $this-&amp;gt;db = $db; } //------------------------------------------------------------------------------ public function avatar_url($res) { $murl = str_replace($this-&amp;gt;to_freichat_path, &amp;quot;&amp;quot;, $this-&amp;gt;url); $avatar_url = $murl . &#039;media/kunena/avatars/resized/size36/&#039; . $res[$this-&amp;gt;avatar_field_name]; return $avatar_url; } //------------------------------------------------------------------------------ public function get_guests() { $query = &amp;quot;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 &amp;quot; . DBprefix . &amp;quot;kunena_users AS k ON f.session_id=k.userid WHERE time&amp;gt;&amp;quot; . $this-&amp;gt;online_time2 . &amp;quot; AND f.session_id!=&amp;quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &amp;quot; AND f.status!=2 AND f.status!=0&amp;quot;; //echo $query; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ public function get_users() { $query = &amp;quot;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 &amp;quot; . DBprefix . &amp;quot;kunena_users AS k ON f.session_id=k.userid WHERE time&amp;gt;&amp;quot; . $this-&amp;gt;online_time2 . &amp;quot; AND f.session_id!=&amp;quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &amp;quot; AND f.guest=0 AND f.status!=2 AND f.status!=0&amp;quot;; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ } ```

Amazing work, thanks a lot for the support. I will do a write-up/tutorial for users (like me) who do not know exactly where to start with this. Again thanks a lot for the support.

Amazing work, thanks a lot for the support. I will do a write-up/tutorial for users (like me) who do not know exactly where to start with this. Again thanks a lot for the support.

Happy Hunting...

280
12
3
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