PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | includes/save-user-meta/save-user-meta.php +19 -4 11.011.8.4 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /**
3 3 * @version 1.0
4 4 * @package Booking Calendar
@@ -116,11 +116,26 @@
116 116 $sanitized_data[ $key ] = is_array( $val ) ? array_map( 'sanitize_text_field', $val )
117 117 : sanitize_text_field( $val );
118 118 }
119 119
120 - update_user_option( $user_id, self::$user_option_prefix . $data_name, $sanitized_data );
121 -
122 - wp_send_json_success( array( 'message' => 'Settings saved successfully.' ) );
120 + $option_name = self::$user_option_prefix . $data_name;
121 + update_user_option( $user_id, $option_name, $sanitized_data );
122 +
123 + $stored_data = get_user_option( $option_name, $user_id );
124 + if ( ! is_array( $stored_data ) || $sanitized_data !== $stored_data ) {
125 + wp_send_json_error( array( 'message' => 'The setting could not be saved. Please reload the page and try again.' ) );
126 + }
127 +
128 + /**
129 + * Fires after Booking Calendar user data has been stored and verified.
130 + *
131 + * @param int $user_id Current WordPress user ID.
132 + * @param string $data_name Sanitized Booking Calendar preference name.
133 + * @param array $sanitized_data Sanitized value confirmed in user metadata.
134 + */
135 + do_action( 'wpbc_user_custom_data_saved', $user_id, $data_name, $sanitized_data );
136 +
137 + wp_send_json_success( array( 'message' => 'Settings saved successfully.' ) );
123 138 }
124 139
125 140 /**
126 141 * Get saved data
@@ -249,5 +264,5 @@
249 264 Save Simple Note
250 265 </a>
251 266 <?php
252 267 }
253 -*/
268 +*/