FreiChat related discussions
Custom avatar in Custom.php

I have read the manual for adding Avatar support in a Custom setup.

I did not changed ag.php because the field name is correct.

//Avatar
$avatar_field_name = 'avatar';


I changed in Custom.php:
public function avatar_url($avatar) {
//$murl = str_replace("server/freichat.php", "", $this->url);
//$avatar_url = $murl . 'client/jquery/user.jpeg';
$murl = "http://www.mysite.nl/img/avatars/";

$avatar_url = $murl . $avatar;
return $avatar_url;
}


The avatar is not showing.

I have read the manual for adding Avatar support in a Custom setup. I did not changed ag.php because the field name is correct. <code> //Avatar $avatar_field_name = 'avatar'; </code> I changed in Custom.php: <code> public function avatar_url($avatar) { //$murl = str_replace("server/freichat.php", "", $this->url); //$avatar_url = $murl . 'client/jquery/user.jpeg'; $murl = "http://www.mysite.nl/img/avatars/"; $avatar_url = $murl . $avatar; return $avatar_url; } </code> The avatar is not showing.

did you enable avatar from the backend?
if yes, then check to see if a broken image(404) is being generated.

did you enable avatar from the backend? if yes, then check to see if a broken image(404) is being generated.
Necessity is the mother of all inventions!

1. avatar in backend is anabled
2. there is no broken image error.

1. avatar in backend is anabled 2. there is no broken image error.

Is it showing the default random avatars ,or something else ?

And have you edited the query as given in the documentation .
Because there is a possibility that , the query is not fetching the avatar
So it is being passed as empty and freichat switches to default avatars .


Is it showing the default random avatars ,or something else ? And have you edited the query as given in the documentation . Because there is a possibility that , the query is not fetching the avatar So it is being passed as empty and freichat switches to default avatars .
Necessity is the mother of all inventions!

Yes, i changed it like this for USER configuration:

public function get_users() {

$query = "SELECT DISTINCT status_mesg,username,session_id,status,guest,X.avatar
FROM frei_session, portaal_users AS X
WHERE time>" . $this->online_time2 . "
AND session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . "
AND guest=0
AND status!=2
AND status!=0
AND X.id= " . $_SESSION[$this->uid . 'usr_ses_id'] . "";

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


the avatars showed are ALL the same, (its MY uploaded avatar!)

Yes, i changed it like this for USER configuration: <code> public function get_users() { $query = "SELECT DISTINCT status_mesg,username,session_id,status,guest,X.avatar FROM frei_session, portaal_users AS X WHERE time>" . $this->online_time2 . " AND session_id!=" . $_SESSION[$this->uid . 'usr_ses_id'] . " AND guest=0 AND status!=2 AND status!=0 AND X.id= " . $_SESSION[$this->uid . 'usr_ses_id'] . ""; $list = $this->db->query($query)->fetchAll(); return $list; } </code> the avatars showed are ALL the same, (its MY uploaded avatar!)

Enable PHP debug in backend

Then before the statement return $list in that function
Add

foreach($list as $list_item)
$this->freichat_debug($list_item);


After , this open freixlog.log . Scroll to the end . And see if you get the avatar url
listed there .

Also ,in chrome open up the console , go to network tab .
Click on freichat request And verify if there are any errors or not .

Enable PHP debug in backend Then before the statement return $list in that function Add <code> foreach($list as $list_item) $this->freichat_debug($list_item); </code> After , this open freixlog.log . Scroll to the end . And see if you get the avatar url listed there . Also ,in chrome open up the console , go to network tab . Click on freichat request And verify if there are any errors or not .
Necessity is the mother of all inventions!

console reports no errors (FreiChatX script initiated (17))
the error log report error ARRAY when i add your lines.

console reports no errors (FreiChatX script initiated (17)) the error log report error ARRAY when i add your lines.

Replace

foreach($list as $list_item)
$this->freichat_debug($list_item);


with
$this->freichat_debug($query);


Now , you should find a raw query in freixlog.log .
Run this query in PhpMyAdmin , and post the output .

Replace <code> foreach($list as $list_item) $this->freichat_debug($list_item); </code> with <code>$this->freichat_debug($query); </code> Now , you should find a raw query in freixlog.log . Run this query in PhpMyAdmin , and post the output .
Necessity is the mother of all inventions!

SELECT DISTINCT status_mesg,username,session_id,status,guest,X.avatar
FROM frei_session, portaal_users AS X
WHERE time>1332522786
AND session_id!=6318
AND guest=0
AND status!=2
AND status!=0
AND X.id= 6318

All the avatars are the same in the list.
This also happens when i take another X.id


SELECT DISTINCT status_mesg,username,session_id,status,guest,X.avatar FROM frei_session, portaal_users AS X WHERE time>1332522786 AND session_id!=6318 AND guest=0 AND status!=2 AND status!=0 AND X.id= 6318 All the avatars are the same in the list. This also happens when i take another X.id

I asked you to run the query in phpmyadmin , if you have done that please post
the output.

I asked you to run the query in phpmyadmin , if you have done that please post the output.
Necessity is the mother of all inventions!

status_mesg username session_id status guest avatar
Beschikbaar Gea 3732 1 0 hf9840984h49u.jpg
Beschikbaar Michel 6042 1 0 hf9840984h49u.jpg
Beschikbaar Joop 80 1 0 hf9840984h49u.jpg
Beschikbaar Simon 2272 1 0 hf9840984h49u.jpg

status_mesg username session_id status guest avatar Beschikbaar Gea 3732 1 0 hf9840984h49u.jpg Beschikbaar Michel 6042 1 0 hf9840984h49u.jpg Beschikbaar Joop 80 1 0 hf9840984h49u.jpg Beschikbaar Simon 2272 1 0 hf9840984h49u.jpg

The query is correct .

And what do you mean by , you get all same avatars ?
It would be nice if you could provide me with a screenshot of the chatbox ,
which will help me to know what is the exact problem .

The query is correct . And what do you mean by , you get all same avatars ? It would be nice if you could provide me with a screenshot of the chatbox , which will help me to know what is the exact problem .
Necessity is the mother of all inventions!
89
16
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