Customizing Frei Chat

How can to customize Frei-chat (a live chat for Elgg 1.8 like Facebook or Google chat) How can to customize Frei-chat (a live chat for Elgg 1.8 like Facebook or Google chat)

Editing the plugins in Frei chat

Open the file

elgg\mod\chat\vendors\freichat\installation\install.php  (before installation)

or

elgg\mod\chat\vendors\freichat\arg.php (after installation)

And change this code

$show_translate_plugin = \'enabled\';
$show_chatroom_plugin = \'disabled\';
$show_videochat_plugin = \'disabled\';
$show_save_plugin = \'enabled\';
$show_smiley_plugin = \'enabled\';
$show_mail_plugin = \'enabled\';

And change this code

$ACL = array(
\'FILE\' => array(
\'user\' => \'allow\',
\'guest\' => \'allow\'
),

\'TRANSLATE\' => array(
\'user\' => \'allow\',
\'guest\' => \'allow\'
),

\'SAVE\' => array(
\'user\' => \'allow\',
\'guest\' => \'allow\'
),

\'SMILEY\' => array(
\'user\' => \'allow\',
\'guest\' => \'allow\'
),

\'MAIL\' => array(
\'user\' => \'allow\',
\'guest\' => \'allow\'
),

\'VIDEOCHAT\' => array(
\'user\' => \'noallow\',
\'guest\' => \'noallow\'
)

);

 

Replacing the plugins in Frei chat

Example:   Smiles after Send file

Open the file

elgg\mod\chat\vendors\freichat\client\freichat.js

Cut this code

  if(freidefines.PLUGINS.showsmiley == 'enabled')
{
if((freidefines.GEN.is_guest == 1 && freidefines.ACL.SMILEY.guest == "allow") || (freidefines.GEN.is_guest == 0 && freidefines.ACL.SMILEY.user == "allow"))
{
pluginhtml += '<span id="freismilebox"><span id="frei_smileys_'+id+'" class="frei_smileys none">'+FreiChat.smileylist(id)+'</span>   </span>';
pluginhtml += '<a href="javascript:void(0)" title="'+freidefines.titles_smiley+'" onmousedown="FreiChat.smiley(\''+id+'\')">                <img id="smile_'+id+'" src="'+FreiChat.make_url(freidefines.smileyimg)+'" alt="-" />                </a>   ';
}
}

And paste it after this code

if(freidefines.PLUGINS.show_file_send == 'true' )
{
if((freidefines.GEN.is_guest == 1 && freidefines.ACL.FILE.guest == "allow") || (freidefines.GEN.is_guest == 0 && freidefines.ACL.FILE.user == "allow"))
{
pluginhtml = '<span id="freifilesend'+id+'"><a href="javascript:void(0)" onClick="FreiChat.upload(\''+user+'\',\''+id+'\')"><img id="upload'+id+'" src="'+FreiChat.make_url(freidefines.uploadimg)+'" title='+freidefines.titles_upload+' alt="upload" /> </a></span>';
}
}

 

 Removing Powered By EvNix

Open the file

elgg\mod\chat\vendors\freichat\client\freichat.js

And delete this code

<div id='evnix"+randstr+"power' class='evnix"+randstr2+"power'><font size='1'>"+freidefines.pwdby+" <a href='http://www.evnix.com' target='_blank'>EvNix</a></font></div>

 

Removing the Additional options

Open the file

elgg\mod\chat\vendors\freichat\client\freichat.js

And delete this code

<span onmousedown='FreiChat.freichatTool(\"nooptions\")'>  <img id='frei_img' src="+FreiChat.make_url(freidefines.toolimg)+" title='"+freidefines.opt_txt+"' alt='option'/> </span>

 

Chat only for logged users
Open the file

elgg\mod\chat\views\default\chat\chat.php

And change this code

if (elgg_get_plugin_setting('chat_installed', 'chat') == 'yes') {

With this

if (elgg_get_plugin_setting('chat_installed', 'chat') == 'yes' && isloggedin()) {

 

Chat only for friends

Open the file

elgg\mod\chat\vendors\freichat\server\drivers\Elgg.php

After this code

$result = $this->getList();

Add this code

$query = "SELECT guid_two FROM " . DBprefix . "entity_relationships WHERE guid_one = " . $_SESSION[$this->uid . 'usr_ses_id'] . " AND relationship = 'friend'";
$friendsarray = $this->db->query($query)->fetchAll();

$friends = array();
foreach($friendsarray as $array){
$friends[] = $array[0];
}

if(count($friends) == 0){
$result = array();
}
else{
for($i=0; $i<count($result); $i++){
if(!in_array($result[$i]['session_id'], $friends)){
unset($result[$i]);
}
}
}
$result = array_values($result);

 

You can to use already customized Chat with Purity Theme by Alex Falk

 

How to install Elgg Chat

(thanks RiverVanRain for this video tutorial)

Share on Facebook
Share on Twitter




61 Responses to “Customizing Frei Chat”

  1. pianist says:

    Chat for Elgg with Purity Theme: http://weborganizm.org/sfera/v/65/elgg-customizations – already customized

  2. Miladin says:

    Hello,

    i wanted to remove the Powered by EvNix but it is not located in the freichat.js! How can i remove it? Thx

  3. hip0 says:

    I can't find any evnix div in freichat.js
    …/mod/chat/vendors/freichat/client$ grep -i evnix freichat.js
    …/mod/chat/vendors/freichat/client$ grep -i randstr2 freichat.js
    …/mod/chat/vendors/freichat/client$ grep -i power freichat.js

    I'm using latest frei-chat with elgg 1.8.3.
    Clearnig this is possible $frei_trans['pwdby'] = 'Powered By';.
    Stil EvNiX keeps showing ..
    Any help is highly appreciated.

    Thx in advance

    • pianist says:

      The aboving examples for Frei Chat ver.1.3 only.
      Latest version is Frei Chat ver.1.5 with external js including 'PoweredBy'

      So. You can to solve this problem with Hack4FreiChat by Alex Falk.
      1. Download http://weborganizm.org/sfera/v/65/elgg-customizations and UnZip it.
      2. Replace
      elgg\mod\chat\views\default\chat\chat.php
      With
      hack4freichat/chat.php
      3. Open the folder
      elgg\mod\chat\vendors\freichat\client\
      And add this file
      hack4freichat/hack.js

      Done!

      Important! FreiChat's author says: 'Link to evnix.com must not removed or altered from the code' ;)

      • chaossepp says:

        Hello!

        This hack does not work for me. I use the Joomla version, but I think the difference is not that big. When I try to load, the chat hangs saying: Fetching…user..data
        kindly wait
        loading………..

        any ideas how to solve that?

        • pianist says:

          Big difference if you using this Elgg hack for Joomla :)

          U try connect to DB via Elgg code.

          If you use the aboving hack only (not hacks in article) that U need replace some codes strings in the file:
          chat.php
          into
          hack4freichat.zip

          OR

          Open your Joomla file:
          chat.php
          And add this code
          <script type="text/javascript" language="javascipt" src="YOUR_PATH_HERE_chat/vendors/freichat/client/hack.js?time=<?php echo time(); ?>" ></script>

          Sure, don't forget about it:
          hack.js from hack4freichat.zip

          • chaossepp says:

            Hi, yes I know this. The chat.php in Joomla is called mod_freichatx.php.
            All I did is changing the line:
            $document->addScript('http://evnix-dot-com.appspot.com/?time=&#039;.time()); from mod_freichatx.php to
            $document->addScript($host.'freichat/client/hack.js?time='.time()); For shure I placed hack.js at the right directory. I think the "same" thing is done in the chat.php hack.
            But this dit not help so far.
            For the moment I use the css hack, but I would prefer the "offline" version… :-)

            • pianist says:

              OK.

              I tried Frei ChatX v6.3.2.

              Before installing I opened this file:
              freichat\installation\drivers\Joomla.php

              And replaced this code:
              <script type="text/javascript" language="javascipt" src="http:// evnix-dot-com.appspot.com/?time=<?php echo time(); ?>" ></script>

              With Alex Falk hack code:
              <script type="text/javascript" language="javascipt" src="http:// MY_PATH_TO/hack.js?time=<?php echo time(); ?>" ></script>

              Next I opened this file:
              freichat\installation\contents.php

              And replaced this code:
              <script type="text/javascript" language="javascipt" src="http:// evnix-dot-com.appspot.com/?time=\'. time() .\'" ></script>

              With AF hack code also:
              <script type="text/javascript" language="javascipt" src="http:// MY_PATH_TO/hack.js?time=\'. time() .\'" ></script>

              Now U try it :)

      • syed says:

        Mr. pianist

        Hi i downloaded the hack chat.php and hack.jc and install in right folder hide the powered by but……. i can see my friend's online but can't able to chat popup is not getting open pls help me reply soon

        Thankyou

  4. suresh says:

    how to download purity theme from.the above link?

  5. jibon says:

    Hello bro,
    Would u plz help me to remove "powered by EvNix" tag from v7.2. I am using joomla with it. Thanks in advance

  6. jibon says:

    Thanks for your reply. But i want to remove only the powered by tag from latest version. I want to learn how to do that. Thanks

  7. syed says:

    Hi
    bro i have big problem which i fine it is chat plugin when it is active mod
    That time if i add or any other user will add means page will reload when i will put the chat in deactivate mod it will not load the page just Ajax icon will lode and it will get add

    only i know that you only to help me so

    again Thank's lot for helping so much

  8. ilham says:

    hallo
    I use freichat 1.6, when I tried to hack the plugin to use hack4freichat freichat disappeared and did not appear again, please let me know to remove evnix: D

  9. kushal says:

    To remove the 'Powered by EvNix' eyesore on the chat, go to mod/chat/vendors/freichat/lang/english.php replace:

    Line 13: $frei_trans['pwdby'] = 'Powered by';

    with

    $frei_trans['pwdby'] = '<noscript>';

  10. anil soni says:

    How to remove 'powered by evnix' in elgg chat window.

  11. andre uebe says:

    Chat only for logged users Tip for Elgg 1.8.X
    =============================================

    For Elgg 1.8.X

    the string to identify logged users it isn't:

    isloggedin()

    but:

    elgg_is_logged_in()

    So, the right way is:

    if (elgg_get_plugin_setting('chat_installed', 'chat') == 'yes' && elgg_is_logged_in())

  12. Jones says:

    Please how can i show friends list whether offline or online in freichat in Elgg? Please help

  13. alkp says:

    how to remove fri chat & chat room in home page ,& what is fri chat admin url , thanks in advance

  14. Jones says:

    Please is there a way to show all friends whether offline or online?

    • alexfalk says:

      Why need it?
      Just use these Chat settings:
      Client side -> I. Show Guests or Resgistered Users -> Buddies
      And you can to see all your friends online and offline >300 ms time left also.
      Of course, you'll not see the users that a long time didn't go to the site

  15. Jones says:

    Thanks for your reply.
    Pls is there no way to increase the time the chat takes to remove the user data from the table when offline?

  16. Azartech says:

    Hi. Thanks for informations. how can i use user's real avatar instead of the freichat default avatar?

  17. moepa says:

    How to become an invite for http://weborganizm.org/ ?

    Regards :)

  18. srinivas says:

    Hello please asset me how to remove the "Powered By Codologic" from the chat box,above mentioned div tag is not there in my freichat.js,and Smiles are not shown in the chat.

  19. srinivas says:

    Hello I am using Frei Chat 1.6.1 these tricks are not working in this version please help me how to do in this version

    thanking you….

Leave a Reply



Similar Elgg Hacks