Plugin Directory

Changeset 1859511


Ignore:
Timestamp:
04/17/2018 05:23:03 AM (8 years ago)
Author:
cometchat
Message:

added feature to syc buddypress groups

Location:
cometchat/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cometchat/trunk/README.txt

    r1826733 r1859511  
    44Requires at least: 3.5.1
    55Tested up to: 4.9.4
    6 Stable tag: 7.0.4
     6Stable tag: 7.0.5
    77License: GNU General Public License v2.0 or later
    88
     
    158158* Fixed issue with download link
    159159* Miscellaneous Bug fixes
     160
     161= 7.0.5 =
     162* Fixed issue with BuddyPress friend synchronization with CometChat
     163* Added feature to synchronization BuddyPress groups in CometChat
     164* Miscellaneous Bug fixes
  • cometchat/trunk/cometchat.php

    r1826733 r1859511  
    44* Plugin Name: CometChat
    55* Description: Voice, video & text chat for your WordPress site
    6 * Version: 7.0.4
     6* Version: 7.0.5
    77* Author: CometChat
    88* Author URI: https://www.cometchat.com/
  • cometchat/trunk/includes/cometchat_cloud.php

    r1858861 r1859511  
    108108        $site_url = get_site_url();
    109109        $protocol = parse_url($site_url);
    110         $request_url  = $protocol['scheme'].'://10108.chatforyoursite.com/cometchat_update.php';
     110        $request_url  = $protocol['scheme'].'://'.$cc_clientid.'.cometondemand.net/cometchat_update.php';
    111111
    112112        if(function_exists('curl_init')){
     
    120120}
    121121
     122/**
     123 * createGroupInCometChat
     124 * Return create group
     125 * @param (type) no param
     126*/
     127function createGroupInCometChat() {
     128    global $cc_clientid;
     129    global $current_user;
     130    $user_id = $current_user->ID;
     131
     132    if(bp_is_active( 'groups' )) {
     133        $group_ids =  groups_get_user_groups( bp_loggedin_user_id() );
     134
     135        if(!empty($_REQUEST['group_id'])){
     136            $groupid = $_REQUEST['group_id'];
     137        }
     138        foreach( $group_ids["groups"] as $id ) {
     139            $group = groups_get_group( array( 'group_id' => $id) );
     140            if($_REQUEST['group_id'] == $group->id){
     141                $groupname = $group->name;
     142            }
     143        }
     144        $groupDetails = array(
     145            "userid"        => $user_id,
     146            "groupid"       => $groupid,
     147            "groupname"     => $groupname,
     148            "action"        => 'creategroup'
     149        );
     150        $groupInfo = json_encode($groupDetails);
     151        $site_url = get_site_url();
     152        $protocol = parse_url($site_url);
     153        $request_url  = $protocol['scheme'].'://'.$cc_clientid.'.cometondemand.net/cometchat_update.php';
     154
     155        if(function_exists('curl_init')){
     156            $result = wp_remote_post($request_url, array(
     157                    'method' => 'POST',
     158                    'body' => 'groupinfo='.$groupInfo
     159                )
     160            );
     161        }
     162    }
     163}
     164
     165/**
     166 * deleteGroupFromCometChat
     167 * Return delete group
     168 * @param (type) no param
     169*/
     170function deleteGroupFromCometChat() {
     171    global $cc_clientid;
     172    global $current_user;
     173    $user_id = $current_user->ID;
     174
     175    if(bp_is_active( 'groups' )) {
     176
     177        if(!empty($_REQUEST['group-id'])){
     178            $groupid = $_REQUEST['group-id'];
     179        }
     180        $groupDetails = array(
     181            "userid"        => $user_id,
     182            "groupid"   => $groupid,
     183            "action"    => 'deletegroup'
     184        );
     185        $groupInfo = json_encode($groupDetails);
     186        $site_url = get_site_url();
     187        $protocol = parse_url($site_url);
     188        $request_url  = $protocol['scheme'].'://'.$cc_clientid.'.cometondemand.net/cometchat_update.php';
     189
     190        if(function_exists('curl_init')){
     191            $result = wp_remote_post($request_url, array(
     192                    'method' => 'POST',
     193                    'body' => 'groupinfo='.$groupInfo
     194                )
     195            );
     196        }
     197    }
     198}
     199
    122200add_action('wp_head', 'getCometChatCloudDockedLayoutCode');
    123201add_action('init','cometchatUserDetails');
     
    126204if(function_exists('bp_is_active')) {
    127205    add_action('init','addCometChatFriends');
     206    add_action( 'groups_group_create_complete',  'createGroupInCometChat' );
     207    add_action( 'groups_delete_group',  'deleteGroupFromCometChat' );
    128208}
    129209
Note: See TracChangeset for help on using the changeset viewer.