FreiChat related discussions
Freichat customization

Hi there,

I installed the Corporate version of FreiChat in my website and works very good but it would be nice to get some tips about some modifications I need to do.

I am using Wordpress for a dating website and I need to add buttons to open a private chat conversation with a single user. This is a screenshot with these buttons marked as red, each link should be able to open a new chatbox, obviously this change should be done from the plugin (if I'm not wrong) but I don't know where can I find the part of code to do this (I assume is almost the same used in the users window) and where should I positionate it if possible.

5383add07be4f.jpg

The last thing is the avatar, is not posible to use Wordpress Gravatars on it?
If is not posible where can i customize it to replace the default ones?

Thank you =)

Hi there, I installed the Corporate version of FreiChat in my website and works very good but it would be nice to get some tips about some modifications I need to do. I am using Wordpress for a dating website and I need to add buttons to open a private chat conversation with a single user. This is a screenshot with these buttons marked as red, each link should be able to open a new chatbox, obviously this change should be done from the plugin (if I'm not wrong) but I don't know where can I find the part of code to do this (I assume is almost the same used in the users window) and where should I positionate it if possible. ![5383add07be4f.jpg](serve/attachment&path=5383add07be4f.jpg) The last thing is the avatar, is not posible to use Wordpress Gravatars on it? If is not posible where can i customize it to replace the default ones? Thank you =)

Hi,

To open a chatwindow , you can use following function:

FreiChat.create_chat_window_mesg(username, userid)

For eg.

FreiChat.create_chat_window_mesg('admin', 1)

The last thing is the avatar, is not posible to use Wordpress Gravatars on it?
If is not posible where can i customize it to replace the default ones?

You can customize them by editing the file freichat/server/freichat.php

Around line 410 , you will find :

$avatar_url = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; //$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 = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar";
    }
}
Hi, To open a chatwindow , you can use following function: ``` FreiChat.create_chat_window_mesg(username, userid) ``` For eg. ``` FreiChat.create_chat_window_mesg('admin', 1) ``` >The last thing is the avatar, is not posible to use Wordpress Gravatars on it? If is not posible where can i customize it to replace the default ones? You can customize them by editing the file freichat/server/freichat.php Around line 410 , you will find : ``` $avatar_url = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; //$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 = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; } } ```
Necessity is the mother of all inventions!

Hi, thanks for the reply.

Now I found some problems using standard Wordpress functions like get_user_meta. Is there any problem with the scope of those functions that I am not considering?

Hi, thanks for the reply. Now I found some problems using standard Wordpress functions like get_user_meta. Is there any problem with the scope of those functions that I am not considering?

No, because freichat is based on classes/objects and rarely uses any global functions.

Are you getting any error ?

No, because freichat is based on classes/objects and rarely uses any global functions. Are you getting any error ?
Necessity is the mother of all inventions!

I changed the code like this:

            $myresult = wp_get_attachment_image_src(384);
            $avatar_url = $myresult[0];


             /*
           $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 = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar";
                }
            }*/

then in the frontend I see the list of users steadily loading and pressing Ctrl+Shift+J I see this:

53a20700a92cd.jpg

I changed the code like this: ```` $myresult = wp_get_attachment_image_src(384); $avatar_url = $myresult[0]; /* $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 = "http://www.gravatar.com/avatar/" . md5($guest) . "?s=24&d=wavatar"; } }*/ ```` then in the frontend I see the list of users steadily loading and pressing Ctrl+Shift+J I see this: ![53a20700a92cd.jpg](serve/attachment&path=53a20700a92cd.jpg)

You cannot use wordpress functions in freichat files like that .
You will have to store the data either in PHP $_SESSION or in database

wp_get_attachment_image_src (384)

I do not understand the use of this function . According to wordpress docs it returns information about an attachment . What is the use of this information ?

You cannot use wordpress functions in freichat files like that . You will have to store the data either in PHP $_SESSION or in database >wp_get_attachment_image_src (384) I do not understand the use of this function . According to wordpress docs it returns information about an attachment . What is the use of this information ?
Necessity is the mother of all inventions!

Ok this is what i wanted to know.

The use of this function

wp_get_attachment_image_src (384)

is to get the avatar url from the current user (actually 384 is to test it with an existant file image). Now I will just create another table in the database to store the data and get the information from there.

Ok this is what i wanted to know. The use of this function ```` wp_get_attachment_image_src (384) ```` is to get the avatar url from the current user (actually 384 is to test it with an existant file image). Now I will just create another table in the database to store the data and get the information from there.

Why not just use SESSION ?

If you have installed FreiChat using the wordpress plugin, you can use your functions in that plugin to store the required data in the SESSION.

You can then fetch that data(stored in SESSION) in the freichat.php file .

Why not just use SESSION ? If you have installed FreiChat using the wordpress plugin, you can use your functions in that plugin to store the required data in the SESSION. You can then fetch that data(stored in SESSION) in the freichat.php file .
Necessity is the mother of all inventions!
350
7
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