SocialEngine PHP

Product:

Installing CometChat as a SocialEngine plugin.

Step 1

Log in to SocialEngine Admin Panel and select ‘Manage tab > Packages & Plugins’.

socialengine1

Step 2

Click on ‘Install New Packages’.

socialengine2

Step 3

Now click on ‘Add packages’, then select tar file (socialengine.tar) and click on install.

socialengine3

Step 4

After the package has been added click on ‘Continue’ button.

socialengine4

Step 5

When asked to ‘Install package “module-cometchat” 1.0.0’, Click on ‘Continue’ button.

socialengine5

Step 6

For ‘FTP Connection Type’ select ‘None’ and click on ‘Continue’ button.

socialengine6

Step 7

It will then run a permission check and once it is completed, you need to click on ‘Continue’ button.

socialengine7

Step 8

Success message for ‘Pre-install Check’ will appear, post that click on ‘Continue’ button.

socialengine8

Step 9

It will update the database, post which you need to click on ‘Finalize Installation’ button.

socialengine9

Step 10

Once the installation is completed, click on ‘back to dashboard’ link to see the CometChat tab in Admin Panel.

socialengine10

Step 11

After selecting the CometChat tab, it will ask you to upload the CometChat zip file.

socialengine11

Step 12

Upload the CometChat zip file and then again click on CometChat tab to view the CometChat Administration Panel.

socialengine12

Step 13

Advance settings:

i. Inbox Synchronization:

Inbox Synchronization can be enabled or disabled from CometChat > Advance Setting > Synchronise inbox to SocialEngine

Then select ‘Yes/No’ to enable/disable inbox synchronization.

Then click on ‘Save Changes’ button to save the changes.

ii. User Group setting:

To enable or disable CometChat for a particular user group go to CometChat > Advance Setting > Hide CometChat for

Select the user groups for which CometChat should be disabled and then click on the ‘Save Changes’ button to save the changes.

socialengine13

You can also view SocialEngine PHP – CometChat Integration tutorial here :

CometChat installation instructions

Step 1 : Add this code to your html page to fetch role and friends information of current logged in user.


<?php
    $friends_array = $this->viewer()->membership()->getMembers();
    foreach( $friends_array as $friend ) {
        $friends .= $friend->getIdentity().",";
    }
    $friends = !empty(rtrim($friends, ',')) ? rtrim($friends, ',') : '';
?>
<?php 
    $chat_role = '';
    if($this->viewer()->getIdentity())
    {
        $chat_role = Engine_Api::_()->getItem('authorization_level', $this->viewer()->level_id)->getTitle();
    }
?> 

Step 2 : Add CometChat Chat Variables in your site template’s head tag.


<script type="text/javascript"> 
    var chat_id = "<?php echo $this->viewer()->getIdentity();?>";
    var chat_name = "<?php echo $this->viewer()->getTitle();?>";
    var chat_link = "<?php echo $this->viewer()->getHref();?>";
    var chat_avatar = "<?php echo $this->viewer()->getPhotoUrl();?>";
 </script>

Step 3 : Add CometChat to your website –

Login to your CometChat Client Area.
Go to : Install CometChat tab on left panel, see Add CometChat step.

For Docked Layout :
» Click on Add To Site

» Copy the the code from the dialog box
» Add this code in your site template’s head tag just after the above mentioned chat variables.

For Embedded Layout :
» Click on Add To Site
» Set the desired height and width values of the chat box in the text boxes provided and Click Generate code.

» Copy the generated embed code and add it your webpage’s HTML accordingly.

That’s It! CometChat has now been integrated on your website.
Go ahead and customize CometChat from your CometChat Client Area.

  • Was this helpful?
  • Yes   No