FreiChat related discussions
Change GRAVATAR avatars to specific image

Here is how you change GRAVATAR avatar "monsters" to any specific image

Edit this file:
www.yourwebsitename.com/freichat/server/freichat.php

Find this code (line: 410) or just search for $avatar_url

$avatar_url = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; //$this->url . "/client/jquery/user.jpeg";

Replace the code above to the code below:

$avatar_url = "http://png1.findicons.com/files/icons/1072/face_avatars/300/i04.png";

P.S. If you want to change the code back to GRAVATAR avatars just create a copy of original line and comment it.

Here is how you change GRAVATAR avatar "monsters" to any specific image Edit this file: www.yourwebsitename.com/freichat/server/freichat.php Find this code (line: 410) or just search for $avatar_url $avatar_url = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; //$this->url . "/client/jquery/user.jpeg"; Replace the code above to the code below: $avatar_url = "http://png1.findicons.com/files/icons/1072/face_avatars/300/i04.png"; P.S. If you want to change the code back to GRAVATAR avatars just create a copy of original line and comment it.

Thanks for sharing the information ,

Just to add:
If you want the url to point to a locally hosted image instead of external url .

You can replace

$avatar_url = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; //$this->url . "/client/jquery/user.jpeg";

with

$avatar_url = $this->url . "/client/jquery/user.jpeg";

Then , upload your image here : freichat/client/jquery/user.jpeg

Thanks for sharing the information , Just to add: If you want the url to point to a locally hosted image instead of external url . You can replace ``` $avatar_url = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; //$this->url . "/client/jquery/user.jpeg"; ``` with ``` $avatar_url = $this->url . "/client/jquery/user.jpeg"; ``` Then , upload your image here : freichat/client/jquery/user.jpeg

Complete code should look like this. We also need to replace the ELSE code. That way that avatar will work in the chatroom users list.

$avatar_url = $this->url . "/client/jquery/user.jpeg";

            if (isset($res[$this->avatar_field_name])) {

                if ($res[$this->avatar_field_name] != "") {
                    $avatar_url = $object->avatar_url($res);
                } else {

$avatar_url = $this->url . "/client/jquery/user.jpeg";
                }
            }

P.S. As a matter of fact there are 2 more lines bellow this code (my lines were 458, 465) where you need to replace $avatar_url with your URL.

Complete code should look like this. We also need to replace the ELSE code. That way that avatar will work in the chatroom users list. ```` $avatar_url = $this->url . "/client/jquery/user.jpeg"; if (isset($res[$this->avatar_field_name])) { if ($res[$this->avatar_field_name] != "") { $avatar_url = $object->avatar_url($res); } else { $avatar_url = $this->url . "/client/jquery/user.jpeg"; } } ```` P.S. As a matter of fact there are 2 more lines bellow this code (my lines were 458, 465) where you need to replace ```` $avatar_url```` with your URL.
553
2
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