fix(vip): Batch 0 wiring for VIP settings, URLs, and order meta
Wire get_vip_settings alias, tab aliases for vip/assets, expired-level meta, VIP2 order-level fallback, JSON-safe order notes, and header/float pay-vip CTAs.
This commit is contained in:
@@ -29,6 +29,18 @@ trait OrderRepositoryCore {
|
||||
|
||||
$order_number = $data['order_number'] ?? $this->generate_order_number();
|
||||
|
||||
// Preserve JSON pay meta (VIP/content/coupon). Only strip tags for plain text notes.
|
||||
$note_raw = (string) ($data['note'] ?? '');
|
||||
$note_trim = trim($note_raw);
|
||||
if ($note_trim !== '' && ($note_trim[0] === '{' || $note_trim[0] === '[')) {
|
||||
$decoded = json_decode($note_trim, true);
|
||||
$note = is_array($decoded)
|
||||
? (string) wp_json_encode($decoded, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)
|
||||
: sanitize_textarea_field($note_raw);
|
||||
} else {
|
||||
$note = sanitize_textarea_field($note_raw);
|
||||
}
|
||||
|
||||
$wpdb->insert($this->table(), [
|
||||
'order_number' => $order_number,
|
||||
'user_id' => (int) ($data['user_id'] ?? 0),
|
||||
@@ -42,7 +54,7 @@ trait OrderRepositoryCore {
|
||||
'created_at' => $data['created_at'] ?? current_time('mysql'),
|
||||
'paid_at' => $data['paid_at'] ?? null,
|
||||
'expires_at' => $data['expires_at'] ?? null,
|
||||
'note' => sanitize_textarea_field((string) ($data['note'] ?? '')),
|
||||
'note' => $note,
|
||||
], ['%s', '%d', '%s', '%d', '%f', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s']);
|
||||
|
||||
if ($wpdb->insert_id) {
|
||||
|
||||
Reference in New Issue
Block a user