SocialEngine 4: Add CometChat Profile Chat Button

Andrew - SocialEngine

Do you use CometChat and would like to allow your members to have an easier way to access chat if you have a lot of members it can be hard sometimes to locate the member you wish to message, with a small modification you can add a Chat with Me button to each profile so when the user is online you can just click the button to start chatting.


  • Open the file: ./application/modules/User/widgets/profile-status/index.tpl
  • Find this code:
<div id='profile_status'>

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

  • and replace with this code:

$user_online_options = include('application/settings/database.php');
$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'>
    <?php echo $this->subject()->getTitle() ?>    
    <a href="javascript: void(0);" onclick="javascript:parent.jqcc.cometchat.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" />';
  • now save and upload to your server, always make a backup of the original file in-case you ever need to revert.

Looking for quality SocialEngine Hosting? Look no further than Arvixe Web Hosting


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

Author Spotlight

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.

Leave a Reply

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