Changeset 3286996
- Timestamp:
- 05/03/2025 09:57:17 PM (11 months ago)
- Location:
- abmsense/trunk
- Files:
-
- 5 edited
-
abmsense.php (modified) (2 diffs)
-
activation_deactivation.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
-
settings.php (modified) (4 diffs)
-
utility.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
abmsense/trunk/abmsense.php
r3286869 r3286996 3 3 Plugin Name: ABMsense - Visitor Identification for B2B Pipeline Growth 4 4 Description: Turn Site Visitors into Hot Leads– It's Marketing Magic! ABMsense is a powerful tool that helps you to identify and track your website visitors. It provides you with the information you need to turn your website visitors into hot leads. With ABMsense, you can track your website visitors, identify their company, and get detailed information about their visit. Go to Settings -> ABMsense to configure the plugin. 5 Version: 3.3. 175 Version: 3.3.35 6 6 Author: Ashley Smith 7 7 Requires PHP: 7.2 … … 26 26 define('ABMSENSE_PREFIX', 'abmsense_'); 27 27 if (!defined('ABMSENSE_VERSION')) { 28 define('ABMSENSE_VERSION', '3.3. 17');28 define('ABMSENSE_VERSION', '3.3.35'); 29 29 } 30 30 -
abmsense/trunk/activation_deactivation.php
r3286869 r3286996 53 53 } 54 54 55 function abmsense_version_check() {56 $current_version = abmsense_get_version();57 $stored_version = get_option(ABMSENSE_PREFIX . 'version_installed');58 59 // Return true if versions are different or if stored_version doesn't exist60 return ($current_version !== $stored_version || !$stored_version);61 }62 63 55 // Function to deactivate the plugin 64 56 function abmsense_deactivate() { … … 75 67 76 68 // Check if upgrade is needed 69 $current_version = abmsense_get_version(); 70 $stored_version = get_option(ABMSENSE_PREFIX . 'version_installed'); 77 71 if (abmsense_version_check()) { 78 72 // Set a longer-lived transient to prevent multiple upgrade attempts … … 86 80 $current_version = abmsense_get_version(); 87 81 88 // Update the version in WordPress options first89 update_option(ABMSENSE_PREFIX . 'version_installed', $current_version);82 // Update plugin data with the new version 83 $api_result = abmsense_update_plugin_data(); 90 84 91 // Update plugin data with the new version 92 abmsense_update_plugin_data(); 85 // Only update the local version if the API call succeeded 86 if ($api_result) { 87 update_option(ABMSENSE_PREFIX . 'version_installed', $current_version); 88 } 93 89 94 90 // Run any additional upgrade tasks … … 103 99 // Function to update plugin data 104 100 function abmsense_update_plugin_data() { 105 // Check if we're in the middle of an upgrade106 if (get_transient(ABMSENSE_PREFIX . 'upgrade_in_progress')) {107 return;108 }109 110 101 $current_user = wp_get_current_user(); 111 102 $server_name = isset($_SERVER['SERVER_NAME']) ? sanitize_text_field(wp_unslash($_SERVER['SERVER_NAME'])) : ''; 112 103 $admin_email = $current_user->user_email ?: 'no-reply@' . $server_name; 113 114 // Get existing values or set defaults115 104 $report_email = get_option(ABMSENSE_PREFIX . 'report_email') ?: $admin_email; 116 105 $report_frequency = get_option(ABMSENSE_PREFIX . 'report_frequency', 'weekly'); 117 106 $is_consent = get_option(ABMSENSE_PREFIX . 'is_consent') ?: 0; 118 107 $date_registered = get_option(ABMSENSE_PREFIX . 'date_registered') ?: gmdate('Y-m-d'); 119 120 // Always use the current version from the plugin file121 108 $version_installed = abmsense_get_version(); 122 123 // Get the user's full name from WordPress if available124 109 $full_name = $current_user->display_name ?: ''; 125 110 update_option(ABMSENSE_PREFIX . 'full_name', $full_name); 126 111 127 // Save/update all plugin data with additional fields 112 // Use the same values as the settings page 113 $consent_update = true; // Match settings page logic for remote update 114 $sku = 'ABM-1000-ID-MONTHLY-FREE-TIER'; 115 $real_time_alert = 'No'; 116 117 // Call the same function as the settings page 128 118 $result = abmsense_save_data( 129 119 $server_name, … … 132 122 $is_consent, 133 123 $date_registered, 134 $version_installed 124 $version_installed, 125 $full_name, 126 $consent_update, 127 $sku, 128 $real_time_alert 135 129 ); 136 130 … … 159 153 add_action('admin_init', 'abmsense_upgrade_completed'); 160 154 register_deactivation_hook(__FILE__, 'abmsense_deactivate'); 155 function abmsense_check_version_on_plugins_page($upgrader_object, $options) { 156 if ($options['action'] === 'update' && $options['type'] === 'plugin') { 157 // Check if our plugin was updated 158 $our_plugin = plugin_basename(__FILE__); 159 if (isset($options['plugins']) && in_array($our_plugin, $options['plugins'])) { 160 delete_option(ABMSENSE_PREFIX . 'version_installed'); 161 } 162 } 163 } 164 add_action('upgrader_process_complete', 'abmsense_check_version_on_plugins_page', 10, 2); 161 165 162 // // Optional: Add this if you want to force an upgrade check on plugins page163 // function abmsense_check_version_on_plugins_page($upgrader_object, $options) {164 // if ($options['action'] === 'update' && $options['type'] === 'plugin') {165 // // Check if our plugin was updated166 // $our_plugin = plugin_basename(__FILE__);167 // if (isset($options['plugins']) && in_array($our_plugin, $options['plugins'])) {168 // delete_transient(ABMSENSE_PREFIX . 'upgrade_completed');169 // }170 // }171 // }172 // add_action('upgrader_process_complete', 'abmsense_check_version_on_plugins_page', 10, 2); -
abmsense/trunk/readme.txt
r3286869 r3286996 7 7 Tested up to: 6.8 8 8 Requires PHP: 7.2 9 Stable tag: 3.3. 179 Stable tag: 3.3.35 10 10 License: GPLv2 or later 11 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 125 125 * Adding Export CSV inside the Identified Companies table 126 126 127 = 3.3. 17=127 = 3.3.35 = 128 128 * Added: User Management table 129 129 * Added: Hot Lead Alerts -
abmsense/trunk/settings.php
r3286855 r3286996 111 111 112 112 // Update the save_data function in settings.php 113 function abmsense_save_data($server_name, $report_email, $report_frequency, $is_consent, $date_registered, $version_installed) { 113 function abmsense_save_data( 114 $server_name, 115 $report_email, 116 $report_frequency, 117 $is_consent, 118 $date_registered, 119 $version_installed, 120 $full_name = '', 121 $consent_update = false, 122 $sku = '', 123 $real_time_alert = '' 124 ) { 114 125 $config = include('db_config.php'); 115 126 $api_url = $config['upsert_abmsense_our_customers_details']; 116 127 $public_key = $config['public_key']; 117 128 118 // Get existing full_name if available119 $full_name = get_option(ABMSENSE_PREFIX . 'full_name', '');120 121 129 $data = [ 122 130 'customer_name' => $server_name, … … 127 135 'version_installed' => $version_installed, 128 136 'full_name' => $full_name, 129 'real_time_alert' => 'No', 130 'sku' => 'ABM-1000-ID-MONTHLY-FREE-TIER' 137 'consent_update' => $consent_update, 138 'sku' => $sku, 139 'real_time_alert' => $real_time_alert 131 140 ]; 132 141 … … 217 226 218 227 if ($user_response_code !== 200 || !isset($user_response_data['success']) || !$user_response_data['success']) { 228 // Check for "Email already exists" and treat as success 229 if (strpos($user_response_body, 'Email already exists') !== false) { 230 return true; 231 } 219 232 abmsense_log('API Error: Failed to create user - ' . $user_response_body . ' - Maybe Customer is reactivated', 'error'); 220 233 return false; … … 232 245 // Set a transient to indicate successful registration 233 246 set_transient(ABMSENSE_PREFIX . 'registration_complete', true, HOUR_IN_SECONDS); 234 247 248 if ($user_response_code === 200 && isset($user_response_data['success']) && $user_response_data['success']) { 249 update_option(ABMSENSE_PREFIX . 'version_installed', $version_installed); 250 } 251 235 252 return true; 236 253 } -
abmsense/trunk/utility.php
r3268419 r3286996 198 198 return $response; 199 199 } 200 201 function abmsense_version_check() { 202 $current_version = abmsense_get_version(); 203 $stored_version = get_option(ABMSENSE_PREFIX . 'version_installed'); 204 return ($current_version !== $stored_version || !$stored_version); 205 } 206 207 add_action('upgrader_process_complete', 'abmsense_check_version_on_plugins_page', 10, 2);
Note: See TracChangeset
for help on using the changeset viewer.