Skip to content

Instantly share code, notes, and snippets.

@wpmudev-sls
Created February 10, 2018 11:17
Show Gist options
  • Save wpmudev-sls/5ed85bc4679fd732af544aa2c13df882 to your computer and use it in GitHub Desktop.
Save wpmudev-sls/5ed85bc4679fd732af544aa2c13df882 to your computer and use it in GitHub Desktop.
[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 );
@wpmudev-sls
Copy link
Author

Additionally you can add
define( 'APP_USE_LEGACY_USERDATA_OVERWRITING',true );
in wp-config.php so it updates the profile values in user meta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment