Plugin Directory

Changeset 3020628


Ignore:
Timestamp:
01/11/2024 08:27:58 PM (2 years ago)
Author:
polyres
Message:

Update compatibility versions in readme and plugin file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • repeat-order-for-woocommerce/trunk/repeat-order-for-woocommerce.php

    r2999554 r3020628  
    44 * Plugin URI: https://poly-res.com/plugins/repeat-order-for-woocommerce/
    55 * Description: Add an "order again" button in Recent Orders list
    6  * Version: 1.3.1
     6 * Version: 1.3.2
    77 * Author: polyres
    88 * Author URI: https://poly-res.com/
     
    1515 * Requires WP:       4.8
    1616 * Requires PHP:      5.3
    17  * Tested up to: 6.4.1
     17 * Tested up to: 6.4.2
    1818 * WC requires at least: 3.4.0
    19  * WC tested up to: 8.3.0
     19 * WC tested up to: 8.4.0
    2020 *
    2121 * @link      https://poly-res.com
     
    3030}
    3131
    32 define( 'PRRO_VERSION', '1.3.1' );
     32define( 'PRRO_VERSION', '1.3.2' );
    3333
    3434
     
    8484     * @access public
    8585     * @param  obj   $upgrader_object  Upgrader object.
    86      * @param  array $options         Options.
     86     * @param  array $options          Options.
    8787     * @return void
    8888     */
     
    9090        $our_plugin = plugin_basename( __FILE__ );
    9191        // If an update has taken place and the updated type is plugins and the plugins element exists.
    92         if ( 'update' === $options['action'] && 'plugin' === $options['type'] && isset( $options['plugins'] ) ) {
    93             // Iterate through the plugins being updated and check if ours is there.
    94             foreach ( $options['plugins'] as $plugin ) {
    95                 if ( $plugin === $our_plugin ) {
    96                     switch ( PRRO_VERSION ) {
    97                         case '1.2.0':
    98                             // Version 1.3.0
    99                             // Add default stat settings and plugin version.
    100                             foreach ( wc_get_order_statuses() as $key => $name ) {
    101                                 if ( false === get_option( 'prro_order_status_' . $key ) ) {
    102                                     if ( 'wc-completed' === $key ) {
    103                                         add_option( 'prro_order_status_' . $key, 'yes' );
    104                                     } else {
    105                                         add_option( 'prro_order_status_' . $key, 'no' );
    106                                     }
    107                                 }
    108                             }
    109                             if ( false === get_option( 'prro_version' ) ) {
    110                                 add_option( 'prro_version', PRRO_VERSION );
    111                             }
    112                             break;
     92        if ( 'update' === $options['action'] && 'plugin' === $options['type'] && in_array( $our_plugin, $options['plugins'], true ) ) {
     93            // Retrieve the current version from the database.
     94            $current_version = get_option( 'prro_version' );
     95            // Compare the current version with the new version.
     96            // If the current version is less than the new version, run the update logic.
     97            if ( version_compare( $current_version, PRRO_VERSION, '<' ) ) {
     98                // Specific update logic for version 1.2.0 to the new version.
     99                if ( version_compare( $current_version, '1.2.0', '<=' ) ) {
     100                    // Perform operations for the new version here.
     101                    foreach ( wc_get_order_statuses() as $key => $name ) {
     102                        if ( false === get_option( 'prro_order_status_' . $key ) ) {
     103                            add_option( 'prro_order_status_' . $key, 'wc-completed' === $key ? 'yes' : 'no' );
     104                        }
    113105                    }
    114106                }
     107                // Update the stored version to the new version after all updates are completed.
     108                update_option( 'prro_version', PRRO_VERSION );
    115109            }
    116110        }
     
    494488        if ( function_exists( 'wc_get_page_screen_id' ) ) {
    495489            $cs = wc_get_page_screen_id('shop-order');
    496             if ( $cs === 'woocommerce_page_wc-orders' ) {
     490            if ( $cs === 'woocommerce_page_wc-orders' || $cs === 'shop_order' ) {
    497491                add_action( 'admin_footer', array( $this, 'order_preview_template' ) );
    498492                add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
Note: See TracChangeset for help on using the changeset viewer.