FreiChat related discussions
Chat Button Profile

Hi,

Is there way for me or part of the code to extract the function when you click a name and then his chat window appears?

Because I plan to remove the main chat list and just add a button on each profile that says "Chat" and indicates if the user is online or not.

When clicked, the chat window of the user will pop up as normally as it should in the current default setup.

Hi, Is there way for me or part of the code to extract the function when you click a name and then his chat window appears? Because I plan to remove the main chat list and just add a button on each profile that says "Chat" and indicates if the user is online or not. When clicked, the chat window of the user will pop up as normally as it should in the current default setup.

Yes, it is possible

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 above function will open a chat window with previous messages loaded .
If you instead want a chatwindow without the chat history .
You can use the function

FreiChat.create_chat_window(username, userid)
Yes, it is possible 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 above function will open a chat window with previous messages loaded . If you instead want a chatwindow without the chat history . You can use the function ``` FreiChat.create_chat_window(username, userid) ```

Thanks Adesh, smile

how about to know whether the user is online or not?

Thanks Adesh, :) how about to know whether the user is online or not?

And lastly, what files do we need to include to call these functions properly? Thank you very much for the help!

And lastly, what files do we need to include to call these functions properly? Thank you very much for the help!

And lastly, what files do we need to include to call these functions properly? Thank you very much for the help!

You do not need to include any files, just make sure freichat is loaded .

how about to know whether the user is online or not?

You can make use of the method FreiChat.API.onUser() for this . This function is called whenever a user is added to online list .
You can compare this against the current user to know if he is online or not .

This function is heavily documented in the file freichat/client/plugins.js

For eg .

  FreiChat.onUser(data, first) {  

      if(data.username == CURRENT_USERNAME) {  
          //show him as online
     }
 }
>And lastly, what files do we need to include to call these functions properly? Thank you very much for the help! You do not need to include any files, just make sure freichat is loaded . >how about to know whether the user is online or not? You can make use of the method FreiChat.API.onUser() for this . This function is called whenever a user is added to online list . You can compare this against the current user to know if he is online or not . This function is heavily documented in the file freichat/client/plugins.js For eg . ``` FreiChat.onUser(data, first) { if(data.username == CURRENT_USERNAME) { //show him as online } } ```

Hi again,

How do I remove the main chat userlist? because I tried making it no display but the active chats that i have disappears after the the offline/busy timeout OR whenever I move to another page.

I intend to move the chat buttons on profiles instead of having a list.

Thanks in advance!

Hi again, How do I remove the main chat userlist? because I tried making it no display but the active chats that i have disappears after the the offline/busy timeout OR whenever I move to another page. I intend to move the chat buttons on profiles instead of having a list. Thanks in advance!

Additional information: I tried making the visibility to hidden in CSS so that it would not display but this was the issue that I encountered.

Any other way to hide the MAIN PANEL without affecting the entire thing? Just like it would if I did not hide the main panel?

Additional information: I tried making the visibility to hidden in CSS so that it would not display but this was the issue that I encountered. Any other way to hide the MAIN PANEL without affecting the entire thing? Just like it would if I did not hide the main panel?

Additional information:
in the CSS i added
visibility: hidden;

So this works but when i use inspect element, and additional appears
display: none;

Do you think this is a factor? I lose the active chat window with a user only after timeout or whenever I move to another page.

Additional information: in the CSS i added visibility: hidden; So this works but when i use inspect element, and additional appears display: none; Do you think this is a factor? I lose the active chat window with a user only after timeout or whenever I move to another page.

Hi,

I was able to solve it. I realized i changed the timeouts too low (3 sec). I changed it back to my "normal settings" and everything worked well.

Now, there's a different issue I encountered. So from the main panel, there is a setting if you want to be available, buys, invi or offline right?

Now when a user chooses to go "offline", but not logged out freichat remembers this on his next log in. Would you be able to tell me where freichat stores this setting?

Because I therefore need to force everyone "online" in their setting so that when i remove the main panel all throughout, everybody, once they log back in will be automatically be online.

i read in one of the forum posts that if you closer your browser this will be forgotten? Is this true regardless of the cookie setting?

Hi, I was able to solve it. I realized i changed the timeouts too low (3 sec). I changed it back to my "normal settings" and everything worked well. Now, there's a different issue I encountered. So from the main panel, there is a setting if you want to be available, buys, invi or offline right? Now when a user chooses to go "offline", but not logged out freichat remembers this on his next log in. Would you be able to tell me where freichat stores this setting? Because I therefore need to force everyone "online" in their setting so that when i remove the main panel all throughout, everybody, once they log back in will be automatically be online. i read in one of the forum posts that if you closer your browser this will be forgotten? Is this true regardless of the cookie setting?

You can programatically make them online by using

FreiChat.freichatopt("goOnline");

i read in one of the forum posts that if you closer your browser this will be forgotten? Is this true regardless of the cookie setting?

FreiChat uses sessionStorage to save these settings. So they will be cleared on closing the browser.

You can programatically make them online by using ``` FreiChat.freichatopt("goOnline"); ``` >i read in one of the forum posts that if you closer your browser this will be forgotten? Is this true regardless of the cookie setting? FreiChat uses *sessionStorage* to save these settings. So they will be cleared on closing the browser.

Thanks Adesh.

This function, which part should I insert this so that when the user logs in my website, it will be called?

Thanks Adesh. This function, which part should I insert this so that when the user logs in my website, it will be called?

You can call this function in the method FreiChat.getdata() in freichat/client/freichat.js

You can call this function in the method FreiChat.getdata() in freichat/client/freichat.js
320
13
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