WC_Customer_Download_Data_Store::delete_download_log_by_field_value()
Delete download_log related to download permission via $field with value $value.
Метод класса: WC_Customer_Download_Data_Store{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->delete_download_log_by_field_value( $field, $value );
- $field(строка) (обязательный)
- Field used to query download permission table with.
- $value(строка|int|float) (обязательный)
- Value to filter the field by.
Код WC_Customer_Download_Data_Store::delete_download_log_by_field_value() WC Customer Download Data Store::delete download log by field value WC 9.3.3
private function delete_download_log_by_field_value( $field, $value ) { global $wpdb; $value_placeholder = ''; if ( is_int( $value ) ) { $value_placeholder = '%d'; } elseif ( is_string( $value ) ) { $value_placeholder = '%s'; } elseif ( is_float( $value ) ) { $value_placeholder = '%f'; } else { wc_doing_it_wrong( __METHOD__, __( 'Unsupported argument type provided as value.', 'woocommerce' ), '7.0' ); // The `prepare` further down would fail if the placeholder was missing, so skip download log removal. return; } $query = "DELETE FROM {$wpdb->prefix}wc_download_log WHERE permission_id IN ( SELECT permission_id FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE {$field} = {$value_placeholder} )"; $wpdb->query( $wpdb->prepare( $query, $value ) // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared ); }