Jump to content

Photo
- - - - -

CHAT WITH ME - Member's profile button for Cometchat!

cometchat customplugin

  • Please log in to reply
4 replies to this topic

#1 kreator

kreator

    Level 3

  • Members
  • Level
  • 61 points
  • 52 posts
    • Gender:Male
    • Software:SE 4.8.x

Posted 17 March 2018 - 10:56 PM

Hi guys, here is another good custom function for your SE site with Cometchat.

 

Follow this guide:

 

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. Replace 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: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" />';
    ?>   
    </a>
    <br>
  </h2>

4. Save the file and upload it to your server via FTP.

5. That's it! Now just use in Layout editor default Profile Status module and place it anywhere in Member's profile page. You can edit the code at your needs, insert some button design style or image.

 

So, now, with this button, when users tap on it, it will open Cometchat chat window of that user, the same way Facebook's message me button works.


Edited by kreator, 17 March 2018 - 10:57 PM.


#2 kreator

kreator

    Level 3

  • Members
  • Level
  • 61 points
  • 52 posts
    • Gender:Male
    • Software:SE 4.8.x

Posted 17 March 2018 - 11:25 PM

This is if you want to modify Profile status widget, but, if you just want to trigger some button to show Cometchat chat window of present user, just add this code anywhere you want:

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

This code doesnt have any text, but you can put it inside like Message me or something, here is an example of Message me text:

<a href="javascript: void(0);" onclick="javascript:parent.jqcc.cometchat.chatWith('<?php echo $this->subject()->user_id;  ?>')">Message me</a>

Hope this additional tutorial could be very useful to you.

 

Regards,

K


Edited by kreator, 17 March 2018 - 11:26 PM.


#3 kreator

kreator

    Level 3

  • Members
  • Level
  • 61 points
  • 52 posts
    • Gender:Male
    • Software:SE 4.8.x

Posted 17 March 2018 - 11:44 PM

If anyone wants I can also provide quick and easy how-to guide for changing SEAO's User Profile Cover module "Send a message" button with this Cometchat instead.



#4 BodyMen

BodyMen

    Level 3

  • Members
  • Level
  • -4 points
  • 73 posts
    • Gender:Male

Posted 04 April 2018 - 08:19 AM

I don't have in: application/modules/User/externals/images/offline.gif - application/modules/User/externals/images/online.gif



#5 sbr

sbr

    Basic Developer

  • Premium
  • Level
  • 51 points
  • 70 posts
    • Gender:Male
    • Location:Hamilton, Canada
    • Software:SE 4.6.x


Users Awards

Posted 23 April 2018 - 03:13 AM

Is this for CometChat Cloud as well?


_________________________________
Boss Ryan
Fetishmen Networks Inc.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


All the resources listed here are just for testing purpose and they shouldn't be used at any commercial environment without a valid license.
Those are for users who wants to try them before buy. Help the developer to build it better by purchasing them from original authors.