FreiChat related discussions
***Avatar Integration Tutorial***

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

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

}
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](http://codologic.com/docs/doku.php?id=wiki:freichat:avatar-integration), 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 &quot;driver&quot; 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&#039;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&#039;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 &quot;avatar&quot;. 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 = &#039;avatar&#039;; ```` If your forum&#039;s user table uses &quot;avatar&quot; 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&#039;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. ```` &amp;lt;?php require &#039;Joomla.php&#039;; class Kunena extends Joomla { public function __construct($db) { //parent::__construct($db); $this-&amp;gt;db = $db; } } ```` Notice the &quot;require &#039;Joomla.php&#039;;&quot; 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(&quot;server/freichat.php&quot;, &quot;&quot;, $this-&amp;gt;url); $avatar_url = $murl . &#039;client/jquery/user.jpeg&#039;; return $avatar_url; } //------------------------------------------------------------------------------ public function get_guests() { $query = &quot;SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room FROM frei_session WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND session_id&amp;lt;&amp;gt;&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND status&amp;lt;&amp;gt;2 AND status&amp;lt;&amp;gt;0&quot;; //echo $query; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ public function get_users() { $query = &quot;SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room FROM frei_session WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND session_id&amp;lt;&amp;gt;&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND guest=0 AND status&amp;lt;&amp;gt;2 AND status&amp;lt;&amp;gt;0&quot;; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ ```` between the last two curly braces in the driver file you are creating. Now you should have: ```` &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(&quot;server/freichat.php&quot;, &quot;&quot;, $this-&amp;gt;url); $avatar_url = $murl . &#039;client/jquery/user.jpeg&#039;; return $avatar_url; } //------------------------------------------------------------------------------ public function get_guests() { $query = &quot;SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room FROM frei_session WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND session_id&amp;lt;&amp;gt;&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND status&amp;lt;&amp;gt;2 AND status&amp;lt;&amp;gt;0&quot;; //echo $query; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); return $list; } //------------------------------------------------------------------------------ public function get_users() { $query = &quot;SELECT DISTINCT status_mesg,username,session_id,status,guest,in_room FROM frei_session WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND session_id&amp;lt;&amp;gt;&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND guest=0 AND status&amp;lt;&amp;gt;2 AND status&amp;lt;&amp;gt;0&quot;; $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;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-&amp;gt;to_freichat_path, &quot;&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; ```` 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 = &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 &quot; . DBprefix . &quot;kunena_users AS k ON f.session_id=k.userid WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND f.session_id!=&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND f.status!=2 AND f.status!=0&quot;; ```` 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. ```` &amp;lt;?php require &#039;Joomla.php&#039;; // Needs to be the name of the CURRENT driver file you are using. You can find this is &quot;path/to/freichat/hardcode.php&quot; class Kunena extends Joomla { // &quot;Joomla&quot; 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-&amp;gt;db = $db; } //------------------------------------------------------------------------------ public function avatar_url($res) { // Builds the avatar URL. $murl = str_replace($this-&amp;gt;to_freichat_path, &quot;&quot;, $this-&amp;gt;url); $avatar_url = $murl . &#039;media/kunena/avatars/resized/size36/&#039; . $res[$this-&amp;gt;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 &quot;k&quot; 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 = &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 &quot; . DBprefix . &quot;kunena_users AS k ON f.session_id=k.userid WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND f.session_id!=&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND f.status!=2 AND f.status!=0&quot;; //echo $query; // Creates an array of everything the query asked for. $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;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&#039;t copy and past because the AND statements are a bit different. $query = &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 &quot; . DBprefix . &quot;kunena_users AS k ON f.session_id=k.userid WHERE time&amp;gt;&quot; . $this-&amp;gt;online_time2 . &quot; AND f.session_id!=&quot; . $_SESSION[$this-&amp;gt;uid . &#039;usr_ses_id&#039;] . &quot; AND f.guest=0 AND f.status!=2 AND f.status!=0&quot;; // Creates an array of everything the query asked for. $list = $this-&amp;gt;db-&amp;gt;query($query)-&amp;gt;fetchAll(); //Returns the array. return $list; } //------------------------------------------------------------------------------ } ````

Happy Hunting...

Please admins make any changes necessary to make this tutorial (more)correct as I am not a professional programmer.

To the rest of you I hope this helps you out, and you are able to get it working first try.

Please admins make any changes necessary to make this tutorial (more)correct as I am not a professional programmer. To the rest of you I hope this helps you out, and you are able to get it working first try.

Happy Hunting...

Thank you very much, if possible pin it for future use.

Thank you very much, if possible pin it for future use.

Happy Hunting...

So how does this work when the avatar URL is NOT stored in the database?

So how does this work when the avatar URL is NOT stored in the database?

Well the thing is that usually that's exactely where the avatar is found. In your situation, where is the avatar for each user stored?

Well the thing is that usually that&#039;s exactely where the avatar is found. In your situation, where is the avatar for each user stored?

Happy Hunting...

Hi,

My Avatar table has two columns that together form a directory path. However, this is still not an URL in itself (just a combined directory 'path' ).

From my vendor's page: https://wearemadhouse.wordpress.com/madhouse-avatar-documentation/

I see that there are helpers available to display the Avatar's URL:

"There’s only 4 helpers that you can use in your theme.

mdh_avatar_nav_url($userId) – Returns the URL to the profile picture in ‘nav’ size.

mdh_avatar_thumbnail_url($userId) – Returns the URL to the profile picture in ‘thumbnail’ size.

mdh_avatar_preview_url($userId) – Returns the URL to the profile picture in ‘preview’ size.

mdh_avatar_normal_url($userId) – Returns the URL to the profile picture in ‘normal’ size."

And other documentation states this:

"echo mdh_avatar_nav_url({USER_ID})
echo mdh_avatar_thumbnail_url({USER_ID})
echo mdh_avatar_preview_url({USER_ID})
echo mdh_avatar_normal_url({USER_ID})

{USER_ID} can be replaced by : osc_logged_user_id(), osc_user_id() or osc_item_user_id() "

The problem I have is that I do not know where to put those helpers in the FreiChat code. I have tried to do it like this:

$avatar_field_name=mdh_avatar_nav_url(osc_logged_user_id());

But unfortunately that didn't work...

Any ideas are most welcome!

Hi, My Avatar table has two columns that together form a directory path. However, this is still not an URL in itself (just a combined directory &#039;path&#039; ). From my vendor&#039;s page: https://wearemadhouse.wordpress.com/madhouse-avatar-documentation/ I see that there are helpers available to display the Avatar&#039;s URL: &quot;There&amp;rsquo;s only 4 helpers that you can use in your theme. mdh_avatar_nav_url($userId) &amp;ndash; Returns the URL to the profile picture in &amp;lsquo;nav&amp;rsquo; size. mdh_avatar_thumbnail_url($userId) &amp;ndash; Returns the URL to the profile picture in &amp;lsquo;thumbnail&amp;rsquo; size. mdh_avatar_preview_url($userId) &amp;ndash; Returns the URL to the profile picture in &amp;lsquo;preview&amp;rsquo; size. mdh_avatar_normal_url($userId) &amp;ndash; Returns the URL to the profile picture in &amp;lsquo;normal&amp;rsquo; size.&quot; And other documentation states this: &quot;echo mdh_avatar_nav_url({USER_ID}) echo mdh_avatar_thumbnail_url({USER_ID}) echo mdh_avatar_preview_url({USER_ID}) echo mdh_avatar_normal_url({USER_ID}) {USER_ID} can be replaced by : osc_logged_user_id(), osc_user_id() or osc_item_user_id() &quot; The problem I have is that I do not know where to put those helpers in the FreiChat code. I have tried to do it like this: $avatar_field_name=mdh_avatar_nav_url(osc_logged_user_id()); But unfortunately that didn&#039;t work... Any ideas are most welcome!
edited Sep 21 '15 at 8:36 pm

Hi,

You have to build the url from the table yourself as those helper functions wont work in freichat files.

Let us know if you need any help in that.

Hi, You have to build the url from the table yourself as those helper functions wont work in freichat files. Let us know if you need any help in that.
600
8
4
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