Plugin Directory

Changeset 2100434


Ignore:
Timestamp:
06/04/2019 01:24:19 PM (7 years ago)
Author:
darklrd
Message:

chat backend update

Location:
iflychat/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • iflychat/trunk/iflychat.php

    r2087821 r2100434  
    22/**
    33 * @package iflychat
    4  * @version 4.6.3
     4 * @version 4.6.4
    55 */
    66/*
     
    99Description: One on one chat, Multiple chatrooms, Embedded chatrooms
    1010Author: iFlyChat Team
    11 Version: 4.6.3
     11Version: 4.6.4
    1212Author URI: https://iflychat.com/
    1313*/
     
    6060}
    6161
    62 define('IFLYCHAT_PLUGIN_VERSION', 'WP-4.6.3');
     62define('IFLYCHAT_PLUGIN_VERSION', 'WP-4.6.4');
    6363if (!defined('IFLYCHAT_DEBUG')) {
    6464  define('IFLYCHAT_DEBUG',          false);
     
    302302            if (is_user_logged_in()) {
    303303                $_SESSION['token'] = $result->access_token;
    304                 // print_r($result);exit;
     304                $result->current_user = $current_user;
     305                $result->test_data = $data;
     306                $should_update = false;
     307                $should_update = iflychat_chatcamp_user_should_update($data, $result->user);
     308                if($should_update === true){
     309                    $options['body'] = json_encode(iflychat_chatcamp_process_user_data($data));
     310                    $result = wp_remote_head(CHATCAMP_EXTERNAL_A_HOST . ':' . CHATCAMP_EXTERNAL_A_PORT . '/api/2.0/users.update', $options);
     311                     if (!is_wp_error($result) && $result['response']['code'] == 200) {
     312                        $result = json_decode($result['body']);
     313                        if (is_user_logged_in()) {
     314                            $_SESSION['token'] = $result->access_token;
     315                            $result->current_user = $current_user;
     316                            // print_r($result);exit;
     317                        }
     318                         return $result;
     319                    }
     320                    else if(!is_wp_error($result) && $result['response']['code'] != 200){
     321                        return $result['response'];
     322                    }
     323                    else {
     324                        $error = array(
     325                            'code' => $result->get_error_code(),
     326                            'message' => $result->get_error_message()
     327                        );
     328                        return $error;
     329                    }
     330                }
    305331            }
    306332            return $result;
     
    313339                if (is_user_logged_in()) {
    314340                    $_SESSION['token'] = $result->access_token;
     341                    $result->current_user = $current_user;
    315342                    // print_r($result);exit;
    316343                }
     
    12201247    $data['check_access_token'] = true;
    12211248    $data['access_token'] = iflychat_get_hash_session();
     1249    $data['metadata'] = array("cc_user_roles" => json_encode($data['user_roles']));
    12221250    return $data;
    12231251}
    12241252
     1253function iflychat_chatcamp_user_should_update($new, $old) {
     1254    $update = false;
     1255    if($new['user_name'] != $old->display_name){
     1256        $update = true;
     1257    }
     1258
     1259    if($new['user_avatar_url'] != $old->avatar_url){
     1260        $update = true;
     1261    }
     1262
     1263    if($new['user_profile_url'] != $old->profile_url){
     1264        $update = true;
     1265    }
     1266
     1267    if(json_encode($new['user_roles']) !== $old->metadata->cc_user_roles){
     1268        $update = true;
     1269    }
     1270   
     1271    return $update;
     1272}
     1273
    12251274?>
  • iflychat/trunk/readme.txt

    r2087821 r2100434  
    44Requires at least: 3.0
    55Tested up to: 5.3
    6 Stable tag: 4.6.3
     6Stable tag: 4.6.4
    77Tags: buddypress, chat, chat room, community, embed chat, friends, group chat, html5 chat, one to one chat, live chat, popup chat, mobile chat, multisite, wordpress chat, wp chat, ultimate member
    88License: GPLv2 or later
     
    138138== Changelog ==
    139139
     140= 4.6.4 =
     141
     14214/05/2019: iFlyChat new backend update.
     143
    140144= 4.6.3 =
    141145
     
    445449== Upgrade Notice ==
    446450
     451= 4.6.4 =
     452After updating, go to iFlyChat Settings page and click on Update button.
     453
    447454= 4.6.3 =
    448455After updating, go to iFlyChat Settings page and click on Update button.
     
    469476After updating, go to iFlyChat Settings page and click on Update button.
    470477
    471 = 4.3.0 =
    472 After updating, go to iFlyChat Settings page and click on Update button.
    473 
    474 
     478
Note: See TracChangeset for help on using the changeset viewer.