Plugin Directory

Changeset 3279299


Ignore:
Timestamp:
04/22/2025 05:23:20 PM (11 months ago)
Author:
flexcubed
Message:

Updating to version 11.0.7 – Bug fixes and improvements.

Location:
pitchprint/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • pitchprint/trunk/functions/general/customization.php

    r3275461 r3279299  
    2626    function save_customization_data($product_id, $customization_data) {
    2727        $user_token = get_user_token();
    28         $transient_key = 'pitchprint_' . $user_token . '_' . $product_id;
    29    
    30         delete_transient($transient_key);
    31         $result = set_transient($transient_key, $customization_data, PITCHPRINT_CUSTOMIZATION_DURATION);
    32         return $result !== FALSE ? $transient_key : FALSE;
     28        $key = 'pitchprint_' . $user_token . '_' . $product_id;
     29
     30        // Try saving to transient first
     31        delete_transient($key);
     32        $transient_result = set_transient($key, $customization_data, PITCHPRINT_CUSTOMIZATION_DURATION);
     33
     34        // Also save to session as a backup
     35        if (session_status() === PHP_SESSION_NONE) {
     36            session_start();
     37        }
     38        $_SESSION[$key] = $customization_data;
     39
     40        // Return the key if transient save was successful, otherwise FALSE
     41        return $transient_result !== FALSE ? $key : FALSE;
    3342    }
    3443
    3544    function get_customization_data($product_id) {
    3645        $user_token = get_user_token();
    37         $transient_key = 'pitchprint_' . $user_token . '_' . $product_id;
     46        $key = 'pitchprint_' . $user_token . '_' . $product_id;
    3847
    39         return get_transient($transient_key);
     48        // Try getting from transient first
     49        $data = get_transient($key);
     50
     51        if ($data !== false) {
     52            return $data;
     53        }
     54
     55        // If transient failed or expired, try getting from session
     56        if (session_status() === PHP_SESSION_NONE) {
     57            session_start();
     58        }
     59
     60        if (isset($_SESSION[$key])) {
     61            // Optionally, restore the transient if found in session
     62            // set_transient($key, $_SESSION[$key], PITCHPRINT_CUSTOMIZATION_DURATION);
     63            return $_SESSION[$key];
     64        }
     65
     66        return false; // Return false if not found in either
    4067    }
    4168
    4269    function delete_customization_data($product_id) {
    4370        $user_token = get_user_token();
    44         $transient_key = 'pitchprint_' . $user_token . '_' . $product_id;
    45    
    46         delete_transient($transient_key);
     71        $key = 'pitchprint_' . $user_token . '_' . $product_id;
     72
     73        // Delete from transient
     74        delete_transient($key);
     75
     76        // Delete from session
     77        if (session_status() === PHP_SESSION_NONE) {
     78            session_start();
     79        }
     80        if (isset($_SESSION[$key])) {
     81            unset($_SESSION[$key]);
     82        }
     83
    4784        return TRUE;
    4885    }
  • pitchprint/trunk/pitchprint.php

    r3275740 r3279299  
    66*   Description:            A beautiful web based print customization app for your online store. Integrates with WooCommerce.
    77*   Author:                 PitchPrint, Inc.
    8 *   Version:                11.0.6
     8*   Version:                11.0.7
    99*   Author URI:             https://pitchprint.com
    1010*   Requires at least:      3.8
     
    4747             *  @var string
    4848            */
    49             public $version = '11.0.6';
     49            public $version = '11.0.7';
    5050
    5151            /**
  • pitchprint/trunk/readme.txt

    r3275740 r3279299  
    44Requires at least: 3.8
    55Tested up to: 6.7
    6 Stable tag: 11.0.6
     6Stable tag: 11.0.7
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    172172
    173173== Changelog ==
     174
     175== 11.0.7 =
     176Added session as backup for saving and retrieving customizations for sites where other plugins resets transient data
     177SVN now includes functions/general/email.php file
    174178
    175179== 11.0.6 =
Note: See TracChangeset for help on using the changeset viewer.