Plugin Directory

Changeset 2895819


Ignore:
Timestamp:
04/08/2023 03:07:41 AM (3 years ago)
Author:
supportcandy
Message:

form fields not loading after v3.1.5 hotfix

Location:
supportcandy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • supportcandy/tags/3.1.5/includes/class-wpsc-sc-upgrade.php

    r2895557 r2895819  
    158158            );
    159159
    160             if ( $customers['total_items'] ) {
     160            if ( $customers['results'] ) {
    161161
    162162                foreach ( $customers['results'] as $customer ) {
     
    173173                    update_user_meta( $customer->user->ID, get_current_blog_id() . '-wpsc-tl-saved-filters', $saved_filters );
    174174                }
     175            } else {
     176
     177                WPSC_Scheduled_Task::destroy( $task );
     178                delete_transient( 'wpsc_upgrade_saved_filter_conditions_cursor' );
    175179            }
    176180
     
    197201        public static function upgrade_condition( $conditions, $relation ) {
    198202
     203            if ( ! $conditions || $conditions == '[]' ) {
     204                return '[]';
     205            }
     206
    199207            $conditions = json_decode( html_entity_decode( $conditions ), true );
     208            $slug_arr = array_keys( $conditions );
     209            if ( is_numeric( $slug_arr[0] ) ) {
     210                return wp_json_encode( $conditions );
     211            }
     212
    200213            $and_conditions = array();
    201214            $or_conditions = array();
     215
    202216            foreach ( $conditions as $slug => $condition ) {
    203217                if ( preg_match( '/^cf_\w+$/', $slug ) ) {
     
    211225                }
    212226            }
     227
    213228            if ( $relation == 'OR' ) {
    214229                $and_conditions[] = $or_conditions;
    215230            }
     231
    216232            return wp_json_encode( $and_conditions );
    217233        }
  • supportcandy/trunk/includes/class-wpsc-sc-upgrade.php

    r2895557 r2895819  
    158158            );
    159159
    160             if ( $customers['total_items'] ) {
     160            if ( $customers['results'] ) {
    161161
    162162                foreach ( $customers['results'] as $customer ) {
     
    173173                    update_user_meta( $customer->user->ID, get_current_blog_id() . '-wpsc-tl-saved-filters', $saved_filters );
    174174                }
     175            } else {
     176
     177                WPSC_Scheduled_Task::destroy( $task );
     178                delete_transient( 'wpsc_upgrade_saved_filter_conditions_cursor' );
    175179            }
    176180
     
    197201        public static function upgrade_condition( $conditions, $relation ) {
    198202
     203            if ( ! $conditions || $conditions == '[]' ) {
     204                return '[]';
     205            }
     206
    199207            $conditions = json_decode( html_entity_decode( $conditions ), true );
     208            $slug_arr = array_keys( $conditions );
     209            if ( is_numeric( $slug_arr[0] ) ) {
     210                return wp_json_encode( $conditions );
     211            }
     212
    200213            $and_conditions = array();
    201214            $or_conditions = array();
     215
    202216            foreach ( $conditions as $slug => $condition ) {
    203217                if ( preg_match( '/^cf_\w+$/', $slug ) ) {
     
    211225                }
    212226            }
     227
    213228            if ( $relation == 'OR' ) {
    214229                $and_conditions[] = $or_conditions;
    215230            }
     231
    216232            return wp_json_encode( $and_conditions );
    217233        }
Note: See TracChangeset for help on using the changeset viewer.