| @@ -439,22 +439,8 @@ | ||
| 439 | 439 | update_option('mxchat_video_embed_enabled', $vce_value); |
| 440 | 440 | wp_send_json_success(['message' => esc_html__('Setting saved', 'mxchat')]); |
| 441 | 441 | return; |
| 442 | 442 | |
| 443 | - // Page-cache purge on settings save (plan b76ed6, Support Ticket 468). | |
| 444 | - // STANDALONE option, same pattern. Default ON — the purge already ships | |
| 445 | - // (3.2.9), so this is an opt-OUT for large sites. Switching it off also | |
| 446 | - // drops a deferred purge the debounce may have scheduled seconds ago, | |
| 447 | - // so "off" takes effect at once rather than after one more purge. | |
| 448 | - case 'mxchat_cache_purge_enabled': | |
| 449 | - $cpe_value = ($value === 'on' || $value === '1') ? 'on' : 'off'; | |
| 450 | - update_option('mxchat_cache_purge_enabled', $cpe_value); | |
| 451 | - if ($cpe_value === 'off' && class_exists('MxChat_Cache_Purge')) { | |
| 452 | - wp_clear_scheduled_hook(MxChat_Cache_Purge::DEFERRED_EVENT); | |
| 453 | - } | |
| 454 | - wp_send_json_success(['message' => esc_html__('Setting saved', 'mxchat')]); | |
| 455 | - return; | |
| 456 | - | |
| 457 | 443 | // Clamped to the same 20-95 the field advertises. An out-of-range or |
| 458 | 444 | // non-numeric POST is corrected rather than refused, and the corrected |
| 459 | 445 | // value is echoed back so the field can reconcile — a silently stored |
| 460 | 446 | // 0 here would put a video on every answer, which is the bug. |
| @@ -1541,10 +1527,9 @@ | ||
| 1541 | 1527 | } |
| 1542 | 1528 | |
| 1543 | 1529 | $product_id = 'MxChatPRO'; |
| 1544 | 1530 | $domain = parse_url(home_url(), PHP_URL_HOST); // Get the current domain |
| 1545 | - $was_active = (get_option('mxchat_license_status', 'inactive') === 'active'); | |
| 1546 | - | |
| 1531 | + | |
| 1547 | 1532 | // Call WooCommerce Software API for activation (not just validation) |
| 1548 | 1533 | $response = wp_remote_get( |
| 1549 | 1534 | add_query_arg( |
| 1550 | 1535 | array( |
| @@ -1590,16 +1575,9 @@ | ||
| 1590 | 1575 | update_option('mxchat_license_status', 'active'); |
| 1591 | 1576 | update_option('mxchat_pro_email', $customer_email); |
| 1592 | 1577 | update_option('mxchat_activation_key', $license_key); |
| 1593 | 1578 | delete_option('mxchat_license_error'); |
| 1594 | - | |
| 1595 | - // A fresh activation starts the licence domain check (c93ede) from a | |
| 1596 | - // clean slate: no grace streak carried over, first daily check at a | |
| 1597 | - // random time within the day. | |
| 1598 | - if (class_exists('MxChat_License_Check')) { | |
| 1599 | - MxChat_License_Check::reset(true); | |
| 1600 | - } | |
| 1601 | - | |
| 1579 | + | |
| 1602 | 1580 | // Also track on your website (this is your existing domain tracking) |
| 1603 | 1581 | $this->track_domain_on_website($license_key, $customer_email, $domain); |
| 1604 | 1582 | |
| 1605 | 1583 | wp_send_json_success(array('message' => esc_html__('License activated successfully', 'mxchat'))); |
| @@ -1606,17 +1584,9 @@ | ||
| 1606 | 1584 | } else { |
| 1607 | 1585 | $error_message = isset($data->error) ? $data->error : esc_html__('Activation failed', 'mxchat'); |
| 1608 | 1586 | update_option('mxchat_license_status', 'inactive'); |
| 1609 | 1587 | update_option('mxchat_license_error', $error_message); |
| 1610 | - | |
| 1611 | - // c93ede: a refusal by the licence owner (domain switched off, new sites | |
| 1612 | - // blocked) or a revoked key is an explicit "off" from mxchat.ai. Remember | |
| 1613 | - // who controls it so Pro & Extensions says so, and keep checking so the | |
| 1614 | - // owner's switch-on restores Pro without another click here. | |
| 1615 | - if (class_exists('MxChat_License_Check')) { | |
| 1616 | - MxChat_License_Check::note_activation_refusal(isset($data->code) ? (string) $data->code : '', (string) $error_message, $was_active); | |
| 1617 | - } | |
| 1618 | - | |
| 1588 | + | |
| 1619 | 1589 | //error_log('MxChat Activation failed: ' . $error_message); |
| 1620 | 1590 | wp_send_json_error($error_message); |
| 1621 | 1591 | } |
| 1622 | 1592 | } |
| @@ -1701,15 +1671,9 @@ | ||
| 1701 | 1671 | delete_option('mxchat_license_status'); |
| 1702 | 1672 | delete_option('mxchat_pro_email'); |
| 1703 | 1673 | delete_option('mxchat_activation_key'); |
| 1704 | 1674 | delete_option('mxchat_license_error'); |
| 1705 | - | |
| 1706 | - // Nothing left to check: drop the licence domain check's state and its | |
| 1707 | - // scheduled event (c93ede). | |
| 1708 | - if (class_exists('MxChat_License_Check')) { | |
| 1709 | - MxChat_License_Check::reset(false); | |
| 1710 | - } | |
| 1711 | - | |
| 1675 | + | |
| 1712 | 1676 | //error_log('MxChat deactivate: Local data cleared'); |
| 1713 | 1677 | |
| 1714 | 1678 | // Notify your website's API to properly deactivate |
| 1715 | 1679 | $response = wp_remote_post('https://mxchat.ai/mxchat-api/deactivate-license', array( |