wpmudev-sls
2/10/2018 - 11:17 AM

[Appointments+] - Force profile fields to be empty in confirmation page

[Appointments+] - Force profile fields to be empty in confirmation page

<?php
/**
* Plugin Name: [Appointments+] - Force profile fields empty
* Plugin URI: https://premium.wpmudev.org/
* Description: With this plugin, the profile fields in the confirmation page should always be empty, so user will need to re-enter
* Author: Panos Lyrakis @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
*/

add_filter( 'app_additional_fields', function( $html_fields ){

	$elements_ids = array( 
		'appointments-field-customer_name',
		'appointments-field-customer_email',
		'appointments-field-customer_phone',
		'appointments-field-customer_address',
		'appointments-field-customer_city'
	);

	$dom = new DOMDocument();
	$dom->loadHTML($html_fields);

	foreach( $elements_ids as $element_id ){
		$el = $dom->getElementById( $element_id );
		$el->setAttribute( 'value', '' );
	}

	$html_fields = $dom->saveHTML();

	return $html_fields;

}, 10 );