' . $code . ' false, ); $user_name_email = isset( $_POST['user_name_email'] ) ? sanitize_text_field( wp_unslash( $_POST['user_name_email'] ) ) : false; $password = isset( $_POST['password'] ) ? wp_unslash( $_POST['password'] ) : false; // phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized $selected_user_name_email = ''; if ( filter_var( $user_name_email, FILTER_VALIDATE_EMAIL ) ) { $selected_user_name_email = sanitize_email( $user_name_email ); } else { $selected_user_name_email = $user_name_email; } $creds = array( 'user_login' => $selected_user_name_email, 'user_password' => $password, 'remember' => false, ); $user = wp_signon( $creds, false ); if ( ! is_wp_error( $user ) ) { $response = array( 'success' => true, ); } else { $response['error'] = wp_kses_post( $user->get_error_message() ); } wp_send_json_success( $response ); } // Login user on modern checkout layout. add_action( 'wp_ajax_astra_woocommerce_login_user', 'astra_addon_woocommerce_login_user' ); add_action( 'wp_ajax_nopriv_astra_woocommerce_login_user', 'astra_addon_woocommerce_login_user' ); /** * Function to filter input of Custom Layout's code editor. * * @param string $output Output. * @param string $key Key. * @return string * @since 4.5.0 */ function astra_addon_filter_code_editor( $output, $key ) { return filter_input( INPUT_POST, $key, FILTER_DEFAULT ); // phpcs:ignore WordPressVIPMinimum.Security.PHPFilterFunctions.RestrictedFilter -- Default filter after all other cases, Keeping this filter for backward compatibility. } add_filter( 'astra_addon_php_default_filter_input', 'astra_addon_filter_code_editor', 10, 2 );