Version Description
Updated experience for existing MobileMonkey users Bug fixes and stability
Download this release
Release Info
Developer | yankovski |
Plugin | WP-Chatbot for Facebook Messenger Customer Chat |
Version | 4.6.1 |
Comparing to | |
See all releases |
Code changes from version 4.6 to 4.6.1
- admin/assets/css/admin-styles.css +17 -1
- admin/class-htcc-admin.php +3 -0
- admin/commons/ht-cc-admin-already-connected-settings-form.php +51 -0
- admin/settings_page.php +10 -2
- inc/MobileMonkeyApi.php +24 -12
- readme.txt +5 -1
admin/assets/css/admin-styles.css
CHANGED
@@ -3402,4 +3402,20 @@ a.go-to-inbox-link img {
|
|
3402 |
font-size: 20px;
|
3403 |
color: #3F5BDC;
|
3404 |
margin-right: 12px;
|
3405 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3402 |
font-size: 20px;
|
3403 |
color: #3F5BDC;
|
3404 |
margin-right: 12px;
|
3405 |
+
}
|
3406 |
+
.already-connected-info {
|
3407 |
+
font-size: 20px;
|
3408 |
+
margin: 36px 0;
|
3409 |
+
line-height: 24px;
|
3410 |
+
font-family: "Open Sans",sans-serif;
|
3411 |
+
}
|
3412 |
+
.already-connected .go_to_mm{
|
3413 |
+
padding: 10px 30px;
|
3414 |
+
background-color: #324ef8;
|
3415 |
+
border-radius: 5px;
|
3416 |
+
color: #fff;
|
3417 |
+
text-decoration: none;
|
3418 |
+
font-size: 16px;
|
3419 |
+
font-family: "Open Sans",sans-serif;
|
3420 |
+
border: none;
|
3421 |
+
}
|
admin/class-htcc-admin.php
CHANGED
@@ -63,6 +63,9 @@ if (!class_exists('HTCC_Admin')) :
|
|
63 |
);
|
64 |
|
65 |
if ($this->fb_page_id && $this->token && $this->internal){
|
|
|
|
|
|
|
66 |
add_submenu_page(
|
67 |
'wp-chatbot',
|
68 |
'wp-chatbot',
|
63 |
);
|
64 |
|
65 |
if ($this->fb_page_id && $this->token && $this->internal){
|
66 |
+
if(get_transient('wp-chatbot__previously-connected-page')) {
|
67 |
+
return;
|
68 |
+
}
|
69 |
add_submenu_page(
|
70 |
'wp-chatbot',
|
71 |
'wp-chatbot',
|
admin/commons/ht-cc-admin-already-connected-settings-form.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* sidebar in admin area - plugin settings page.
|
5 |
+
*
|
6 |
+
* @uses at settings_page.php
|
7 |
+
*
|
8 |
+
*/
|
9 |
+
|
10 |
+
if (!defined('ABSPATH')) exit;
|
11 |
+
|
12 |
+
?>
|
13 |
+
<div class="already-connected tab-content current">
|
14 |
+
<div class="already-connected-info">
|
15 |
+
All set! The chat widget is now installed on your website.
|
16 |
+
<br />
|
17 |
+
Go back to MobileMonkey to activate it.
|
18 |
+
</div>
|
19 |
+
|
20 |
+
|
21 |
+
<a target="_blank" rel="noopener noreferrer" href="<?php echo $app_domain ?>chatbot-editor/<?php echo $connected_page['bot_id'] ?>/customer-chat" class="go_to_mm"><?php _e('Go to MobileMonkey') ?></a>
|
22 |
+
|
23 |
+
<?php
|
24 |
+
|
25 |
+
$fb_connected_area_active_page_settings = [
|
26 |
+
'connected_page' => $connected_page
|
27 |
+
];
|
28 |
+
HT_CC::view('ht-cc-admin-form-bottom-connect', $fb_connected_area_active_page_settings); ?>
|
29 |
+
|
30 |
+
<div id="to_pro" class="modal">
|
31 |
+
<div class="modal_close">X</div>
|
32 |
+
<div class="upgrade__wrapper">
|
33 |
+
<div class="upgrade__content">
|
34 |
+
<h4><?php _e('Are you sure that you want to disconnect this page?') ?></h4>
|
35 |
+
<p><?php _e('Disconnecting will remove the chat widget from your WordPress site. Your chatbot will remain connected to your Facebook Page and can still be managed directly from MobileMonkey.') ?></p>
|
36 |
+
</div>
|
37 |
+
<div class="upgrade__button">
|
38 |
+
<a class="button-close-modal blues" href="#"><?php _e('Cancel') ?></a>
|
39 |
+
<a href="<?php echo $connected_page['path']; ?>" id="disconnect" class="button-lazy-load reds"><?php _e('Disconnect') ?>
|
40 |
+
<div class="lazyload"></div>
|
41 |
+
</a>
|
42 |
+
|
43 |
+
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div class="modal-overlays" id="modal-overlay">
|
49 |
+
</div>
|
50 |
+
|
51 |
+
</div>
|
admin/settings_page.php
CHANGED
@@ -51,8 +51,16 @@ if ($api->getActiveBotId()) {
|
|
51 |
}
|
52 |
$this->api->getSubscribeInfo();
|
53 |
$activePage = $this->api->getActivePage($reset);
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
if ($actpage['bot_id']){
|
57 |
if ( isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated']){
|
58 |
$update = true;
|
51 |
}
|
52 |
$this->api->getSubscribeInfo();
|
53 |
$activePage = $this->api->getActivePage($reset);
|
54 |
+
$actpage = get_option("mobilemonkey_active_page_info");
|
55 |
+
$previouslyConnected = get_transient('wp-chatbot__previously-connected-page');
|
56 |
+
if ($actpage && $previouslyConnected) {
|
57 |
+
$already_connected_settings_form_settings = [
|
58 |
+
'connected_page' => $actpage,
|
59 |
+
'app_domain' => $this->api->app_domain,
|
60 |
+
];
|
61 |
+
HT_CC::view('ht-cc-admin-already-connected-settings-form', $already_connected_settings_form_settings);
|
62 |
+
}
|
63 |
+
else if ($actpage) {
|
64 |
if ($actpage['bot_id']){
|
65 |
if ( isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated']){
|
66 |
$update = true;
|
inc/MobileMonkeyApi.php
CHANGED
@@ -163,7 +163,8 @@ class MobileMonkeyApi
|
|
163 |
'path' => add_query_arg([
|
164 |
'page' => $this->plugin_name,
|
165 |
'connect' => $page->remote_id,
|
166 |
-
'page_name' => $page->name
|
|
|
167 |
], admin_url('admin.php')),
|
168 |
];
|
169 |
|
@@ -442,7 +443,9 @@ class MobileMonkeyApi
|
|
442 |
{
|
443 |
$pageId = filter_input(INPUT_GET, "connect", FILTER_SANITIZE_STRING);
|
444 |
$pageName = filter_input(INPUT_GET, "page_name", FILTER_SANITIZE_STRING);
|
|
|
445 |
if ($pageId && $pageName) {
|
|
|
446 |
$this->setAvailableCompany();
|
447 |
if (!$this->getCompanyId($pageId)){
|
448 |
$this->renderError('This Facebook page has already been connected in MobileMonkey to a company that you don\'t have access to. Please contact support@mobilemonkey.com for more information on how to resolve this issue.');
|
@@ -555,12 +558,31 @@ class MobileMonkeyApi
|
|
555 |
$this->ErrorHandler($response,'AS State Save','');
|
556 |
}
|
557 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
558 |
public function disconnectPage($pageId='')
|
559 |
{
|
560 |
if (!$pageId){
|
561 |
$pageId = filter_input(INPUT_GET, "disconnect", FILTER_SANITIZE_STRING);
|
562 |
}
|
563 |
if ($pageId) {
|
|
|
|
|
|
|
|
|
|
|
564 |
$args = [
|
565 |
'timeout' => 10,
|
566 |
'body' => json_encode([
|
@@ -576,17 +598,7 @@ class MobileMonkeyApi
|
|
576 |
$content = wp_remote_retrieve_body($response);
|
577 |
$connect_response = json_decode($content);
|
578 |
if (empty($content)) {
|
579 |
-
$this->
|
580 |
-
delete_option('htcc_as_options');
|
581 |
-
delete_option($this->option_prefix . 'page_info');
|
582 |
-
delete_option($this->option_prefix . 'account_info');
|
583 |
-
delete_option($this->option_prefix . 'current_subscribe');
|
584 |
-
delete_option($this->option_prefix . 'message_statistic');
|
585 |
-
delete_option($this->option_prefix . 'wp_plan');
|
586 |
-
delete_option($this->option_prefix . 'active_page_info');
|
587 |
-
delete_option('htcc_fb_js_src');
|
588 |
-
$this->refreshSettingsPage();
|
589 |
-
|
590 |
return true;
|
591 |
|
592 |
} elseif (isset($response["response"]["code"]) && $response["response"]["code"] == 422) {
|
163 |
'path' => add_query_arg([
|
164 |
'page' => $this->plugin_name,
|
165 |
'connect' => $page->remote_id,
|
166 |
+
'page_name' => $page->name,
|
167 |
+
'already_connected' => $page->facebook_page_id !== null
|
168 |
], admin_url('admin.php')),
|
169 |
];
|
170 |
|
443 |
{
|
444 |
$pageId = filter_input(INPUT_GET, "connect", FILTER_SANITIZE_STRING);
|
445 |
$pageName = filter_input(INPUT_GET, "page_name", FILTER_SANITIZE_STRING);
|
446 |
+
$alreadyConnected = filter_input(INPUT_GET, "already_connected", FILTER_SANITIZE_STRING);
|
447 |
if ($pageId && $pageName) {
|
448 |
+
set_transient( 'wp-chatbot__previously-connected-page', $alreadyConnected == '1' );
|
449 |
$this->setAvailableCompany();
|
450 |
if (!$this->getCompanyId($pageId)){
|
451 |
$this->renderError('This Facebook page has already been connected in MobileMonkey to a company that you don\'t have access to. Please contact support@mobilemonkey.com for more information on how to resolve this issue.');
|
558 |
$this->ErrorHandler($response,'AS State Save','');
|
559 |
}
|
560 |
|
561 |
+
public function localDisconnectPage()
|
562 |
+
{
|
563 |
+
$this->active_page = false;
|
564 |
+
delete_option('htcc_as_options');
|
565 |
+
delete_option($this->option_prefix . 'page_info');
|
566 |
+
delete_option($this->option_prefix . 'account_info');
|
567 |
+
delete_option($this->option_prefix . 'current_subscribe');
|
568 |
+
delete_option($this->option_prefix . 'message_statistic');
|
569 |
+
delete_option($this->option_prefix . 'wp_plan');
|
570 |
+
delete_option($this->option_prefix . 'active_page_info');
|
571 |
+
delete_option('htcc_fb_js_src');
|
572 |
+
$this->refreshSettingsPage();
|
573 |
+
}
|
574 |
+
|
575 |
public function disconnectPage($pageId='')
|
576 |
{
|
577 |
if (!$pageId){
|
578 |
$pageId = filter_input(INPUT_GET, "disconnect", FILTER_SANITIZE_STRING);
|
579 |
}
|
580 |
if ($pageId) {
|
581 |
+
$previouslyConnected = get_transient('wp-chatbot__previously-connected-page');
|
582 |
+
if ($previouslyConnected) {
|
583 |
+
$this->localDisconnectPage();
|
584 |
+
return true;
|
585 |
+
}
|
586 |
$args = [
|
587 |
'timeout' => 10,
|
588 |
'body' => json_encode([
|
598 |
$content = wp_remote_retrieve_body($response);
|
599 |
$connect_response = json_decode($content);
|
600 |
if (empty($content)) {
|
601 |
+
$this->localDisconnectPage();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
602 |
return true;
|
603 |
|
604 |
} elseif (isset($response["response"]["code"]) && $response["response"]["code"] == 422) {
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Requires at least: 4.6
|
|
3 |
Tested up to: 5.4.1
|
4 |
Requires PHP: 5.6
|
5 |
Contributors: larrykim, yankovski
|
6 |
-
Stable tag: 4.6
|
7 |
Tags: free live chat, facebook messenger, chatbot, live support, customer chat, web chat plugin, website chat widget, chat marketing, customer support, artificial intelligence, sms tools, mobilemonkey
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -586,6 +586,10 @@ WP-Chatbot is extremely flexible, versatile, and compatible. Because it works se
|
|
586 |
|
587 |
== Changelog ==
|
588 |
|
|
|
|
|
|
|
|
|
589 |
= 4.6 =
|
590 |
Introduced Chatbot Settings feature
|
591 |
Bug fixes and stability
|
3 |
Tested up to: 5.4.1
|
4 |
Requires PHP: 5.6
|
5 |
Contributors: larrykim, yankovski
|
6 |
+
Stable tag: 4.6.1
|
7 |
Tags: free live chat, facebook messenger, chatbot, live support, customer chat, web chat plugin, website chat widget, chat marketing, customer support, artificial intelligence, sms tools, mobilemonkey
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
586 |
|
587 |
== Changelog ==
|
588 |
|
589 |
+
= 4.6.1 =
|
590 |
+
Updated experience for existing MobileMonkey users
|
591 |
+
Bug fixes and stability
|
592 |
+
|
593 |
= 4.6 =
|
594 |
Introduced Chatbot Settings feature
|
595 |
Bug fixes and stability
|