SocialEngine 4: Add Online Button for ArrowChat

This article will help you add an “Online /Offline” button that, when it’s clicked, will open the chat with ArrowChat. To add this, follow these steps:

1) Open the file: ./application/modules/User/widgets/profile-status/index.tpl

2) Find this code:

<div id='profile_status'>

  <h2>

    <?php echo $this->subject()->getTitle() ?>

  </h2>

3) And replace it with this code:

<?php 

$user_online_options = include('application/settings/database.php');

mysql_connect($user_online_options['params']['host'],$user_online_options['params']['username'],$user_online_options['params']['password']);

mysql_select_db($user_online_options['params']['dbname']);

$user_online_query = mysql_query("SELECT * FROM engine4_user_online WHERE user_id=" . $this->subject()->user_id);

$user_is_online = mysql_num_rows($user_online_query);

?>

<div id='profile_status'>

  <h2>

    <?php echo $this->subject()->getTitle() ?>

    <a href="javascript: void(0);" onclick="javascript:jqac.arrowchat.chatWith('<?php echo $this->subject()->user_id;  ?>')">

        <?php if($user_is_online) echo '<img src="application/modules/User/externals/images/online.gif" alt="Online" />';

    else echo '<img src="application/modules/User/externals/images/offline.gif" alt="Offline" />';

    ?>

    </a>

    <br>

  </h2>

4) Search on Google for an icon (PNG) “Online” and “Offline” status and upload this two icons into: ./application/modules/User/externals/images

5)  You’re done!

Looking for quality Social Engine Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , , , , | Posted under SocialEngine | RSS 2.0

Author Spotlight

Andrew Cross

Andrew Cross

Hi, I'm Andrew. A am a 26, ICT Administrator which offers support to company's around the South Wales Area. I have created a few social sites for myself and other company's. So far 2 out of 3 have been successful using the powerful SocialEngine Script. I continue to try and help the community of SocialEngine by giving Support and Technical Help where possible.

2 Comments on SocialEngine 4: Add Online Button for ArrowChat

  1. Tester says:

    This only works if user logs out. And if only turns off chat, it says user still online.

    • Andrew Cross Andrew Cross says:

      Please can you provide more information on your SE Version and AC Version as it all seems to work as it pulling data from your arrowchat database so could be a in your AC Version

Leave a Reply

Your email address will not be published. Required fields are marked *


− 1 = 7

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>