Plugin Directory

Changeset 3385193


Ignore:
Timestamp:
10/27/2025 11:49:59 AM (5 months ago)
Author:
metriondev
Message:

Re bundle on save settings

Location:
metrion
Files:
55 added
2 edited

Legend:

Unmodified
Added
Removed
  • metrion/trunk/main.php

    r3382453 r3385193  
    33* Plugin Name:          Metrion
    44* Description:          Skip manual implementation, sync data directly tailored to destinations like Google Ads and Meta Ads.
    5 * Version:              1.5.8
     5* Version:              1.5.9
    66* Author:               Metrion
    77* Author URI:           https://getmetrion.com
     
    1212if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    1313
    14 define('GLOBAL_METRION_PLUGIN_VERSION', '1.5.8');
     14define('GLOBAL_METRION_PLUGIN_VERSION', '1.5.9');
     15
     16require_once plugin_dir_path(__FILE__) . 'includes/js_bundler.php';
    1517
    1618// Register plugin settings for webhook URL, API path, debug mode, cookie name, and expiration time
     
    217219            $apiSecret = $googleAnalyticsSync ? reset($googleAnalyticsSync)['apiSecret'] ?? '' : '';
    218220            update_option('metrion_google_analytics_api_secret', $apiSecret);
     221           
     222            if (function_exists('metrion_generate_pre_consent_js_bundle')) {
     223                metrion_generate_pre_consent_js_bundle();
     224                metrion_generate_complete_js_bundle();
     225                metrion_generate_destination_js_bundle();
     226                metrion_generate_detect_js_bundle();
     227            }
    219228         
    220229            if ($add_errors) {
     
    372381   
    373382    add_action('admin_enqueue_scripts', 'metrion_enqueue_admin_assets');   
    374 
    375 
    376     // Load back-end includes only in admin page of metrion
    377     //if (isset($_GET['page']) && $_GET['page'] === 'metrion-settings' || (isset($_POST['option_page']) && $_POST['option_page'] === 'metrion_options_group')) {
    378     require_once plugin_dir_path(__FILE__) . 'includes/js_bundler.php';
    379 
    380     add_action('updated_option', 'metrion_regenerate_bundles_on_settings_change', 10, 3);
    381 
    382     function metrion_regenerate_bundles_on_settings_change($option_name, $old_value, $new_value) {
    383         $relevant_options_prefix = 'metrion_';
    384 
    385         // Only trigger bundle regeneration if it's one of our plugin's settings
    386         if (strpos($option_name, $relevant_options_prefix) === 0 && $old_value !== $new_value) {
    387             // // Optional: Only regenerate on real admin save
    388             // if (is_admin()) {
    389                 metrion_generate_pre_consent_js_bundle();
    390                 metrion_generate_complete_js_bundle();
    391                 metrion_generate_destination_js_bundle();
    392                 metrion_generate_detect_js_bundle();
    393             // }
    394         }
    395     }
    396     //}
    397383}
    398384
  • metrion/trunk/readme.txt

    r3382453 r3385193  
    44Requires at least: 3.8
    55Tested up to: 6.8
    6 Stable tag: 1.5.8
     6Stable tag: 1.5.9
    77Requires PHP: 7.1
    88License: GPLv3 or later
     
    8787
    8888== Changelog ==
     89
     90= 1.5.9 =
     91- Fixed js bundler on settings save
    8992
    9093= 1.5.8 =
Note: See TracChangeset for help on using the changeset viewer.