When no fields are required or there is an additional field added. it automatically logs the last

Problem:
When no fields are required or there is an additional field added. but no email required the appointments confirmation automatically logs the last email entered in the required email log from that browser's cache.
I am testing this in http://www.massagetx.com/kwtest.

What is happening in my real site http://www.massagetx.com/kww is that the last person that entered their email in the required email field of this companies particular iPad it is reappearing everytime in the backend under the email field. Her name is Jyondo@steelcase.com.

I replicate this in my iPad witch had no previous cache for the email field and in my Mac Safari/foxfire which both automatically appears in the backend appointment email field.

What I am trying to do is:
I want to be able to not require the email to be entered when booking an appointment, but I want to give people the option of adding an email if they want a confirmation email. And I want them to get a reminder/cofirmation email if the chose to enter a email

I have granted permission in both http://www.massagetx.com/kww and http://www.massagetx.com/kwwtest

thank you,
matt

  • Mattbkelly

    I deactivated all other plugin in my http://www.massagetx.com/kwwtest site and am still having the problem of the email being filled in automatically from the browser's cache.

    then I deleted foxfire's history and no email was added to the required email field- but I can't clear the cache of every companies devices. How can I make this work?

    Right now I have to click on require email under app. settings - general. But many of the people that are signing up on public devices do not own a email.

  • Mattbkelly

    tested in chrome with all plugins and addtional fields add on deactivated but not require email - not logged in as admin (not having used chrome to schedule before it did not add a email to the backend)

    Then I added require email and and booked an appointment -( it of course showed what email I put in)

    Then I required email in the settings and tested in chrome (this failed it remembered chromes last email when email was required)

    Auggg!

  • Ash

    Hello @Mattbkelly

    I hope you are doing good and thanks for asking the question.

    I think this is because Appointments+ is designed to pre-populate some fields, like if you are logged in then it will use your email address and if you are not logged in it will use last used email address.

    What I understood so far, you don't want the email (and other fields) field pre-populated, right?

    Cheers
    Ash

  • Mattbkelly

    Better yet I want the option for them not to be pre populated. Also the name can not be repopulated either.

    The booking is being done on many public iPads starting today. The iPads can not have the last persons info in them nor add prepopulated info to them in the backend if the required email/name is NOT checked in settings. Yesterday I have 200 emails sent to one person, that was not a very good thing for me.

    Is there a MU I can put in to at least not prepopulate fields, if not as well to allow people the option to add name and email so they may be able to receive a confirmation.
    thanks ASH

  • Ash

    Hello there

    I have enabled email field in your site. Now, would you please add the following code?

    add_action( 'wp_footer', 'custom_script' );
    function custom_script() {
        ?>
        <script type="text/javascript">
        jQuery(function($) {
            var intervalSet = setInterval(
              function() {
                if($('.appointments-confirmation-wrapper').is(':visible')) {
                  $('.appointments-confirmation-wrapper').each(function() {
                    $(this).find('input[type=text]').val('');
                  });
                  clearInterval(intervalSet);
                }
              }, 500
            );
          });
        </script>
        <?php
    }

    You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name 'mu-plugins'. If there is no folder in that name, then create a folder, name it 'mu-plugins', create a file inside that, give any name you like and paste the code in there. You don't need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash

    Hi matt

    Please try the following code:

    add_filter( 'app_footer_scripts', 'app_footer_scripts' );
    function app_footer_scripts( $script ) {
        $search = 'if($(".appointments-email-field-entry").val()=="" ) {alert(app_warning_text);$(".appointments-email-field-entry").focus();return false;}';
        $replace = 'if($(".appointments-email-field-entry").val()=="" ) {$(".appointments-email-field-entry").val("anonymous@appointment.com")}';
        return str_replace( $search, $replace, $script );
    }

    We still need to use an email, so I have set a dummy email when there is no email - anonymous@appointment.com

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash

    Hi matt

    You missed the php tag - <?php

    You just paste my last code below my first code. The total code could be:

    add_action( 'wp_footer', 'custom_script' );
    function custom_script() {
        ?>
        <script type="text/javascript">
        jQuery(function($) {
            var intervalSet = setInterval(
              function() {
                if($('.appointments-confirmation-wrapper').is(':visible')) {
                  $('.appointments-confirmation-wrapper').each(function() {
                    $(this).find('input[type=text]').val('');
                  });
                  clearInterval(intervalSet);
                }
              }, 500
            );
          });
        </script>
        <?php
    }
    
    add_filter( 'app_footer_scripts', 'app_footer_scripts' );
    function app_footer_scripts( $script ) {
        $search = 'if($(".appointments-email-field-entry").val()=="" ) {alert(app_warning_text);$(".appointments-email-field-entry").focus();return false;}';
        $replace = 'if($(".appointments-email-field-entry").val()=="" ) {$(".appointments-email-field-entry").val("anonymous@appointment.com")}';
        return str_replace( $search, $replace, $script );
    }

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Ash

    Hello @Mattbkelly

    That is surprising to that the add_filter doesn't need the <?php tag?

    You need to put the php start tag only once unless you close the tag :slight_smile:

    About the email, well, every user must provide an email address. When an user doesn't provide an email, we are faking the email field with a dummy email address.

    All the confirmation/reminder/cancelation emails are sent, and always a copy is sent to admin. So, if the user has valid email, he and you both will receive an email.

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

  • Mattbkelly

    My question is, do I have my settings correct int the above picture?
    1. require these from the client - the email is not checked
    2. Add new field - I added and non required email.

    Can I use this field for a non logged in client to receive the email confirmations? Currently the only think the MU plugin is doing, is providing a dummy email address for the confirmations to go to.

    or is my MU plugin not working correctly?
    I have granted access to:
    http://www.massagetx.com/kwwtest

    thank you,
    matt

  • Mattbkelly

    Here is my mu plugin

    <?php
    
    add_action( 'wp_footer', 'custom_script' );
    function custom_script() {
        ?>
        <script type="text/javascript">
        jQuery(function($) {
            var intervalSet = setInterval(
              function() {
                if($('.appointments-confirmation-wrapper').is(':visible')) {
                  $('.appointments-confirmation-wrapper').each(function() {
                    $(this).find('input[type=text]').val('');
                  });
                  clearInterval(intervalSet);
                }
              }, 500
            );
          });
        </script>
        <?php
    }
    
    add_filter( 'app_footer_scripts', 'app_footer_scripts' );
    function app_footer_scripts( $script ) {
        $search = 'if($(".appointments-email-field-entry").val()=="" ) {alert(app_warning_text);$(".appointments-email-field-entry").focus();return false;}';
        $replace = 'if($(".appointments-email-field-entry").val()=="" ) {$(".appointments-email-field-entry").val("anonymous@appointment.com")}';
        return str_replace( $search, $replace, $script );
    }
  • Ash

    Hi there

    Keep the exact same settings, and replace my above code with the following:

    add_filter( 'app_footer_scripts', 'app_footer_scripts' );
    function app_footer_scripts( $script ) {
        $search = 'if($(".appointments-email-field-entry").val()=="" ) {alert(app_warning_text);$(".appointments-email-field-entry").focus();return false;}';
        $replace = 'if($(".appointments-email-field-entry").val()=="" ) {$(".appointments-email-field-entry").val("anonymous@appointment.com");post_data.app_email="anonymous@appointment.com"}';
        return str_replace( $search, $replace, $script );
    }

    Have an awesome day!

    Cheers
    Ash

  • Ash

    Ohh I mean replace just the second part. To make it clear replace the following:

    add_filter( 'app_footer_scripts', 'app_footer_scripts' );
    function app_footer_scripts( $script ) {
        $search = 'if($(".appointments-email-field-entry").val()=="" ) {alert(app_warning_text);$(".appointments-email-field-entry").focus();return false;}';
        $replace = 'if($(".appointments-email-field-entry").val()=="" ) {$(".appointments-email-field-entry").val("anonymous@appointment.com")}';
        return str_replace( $search, $replace, $script );
    }

    with

    add_filter( 'app_footer_scripts', 'app_footer_scripts' );
    function app_footer_scripts( $script ) {
        $search = 'if($(".appointments-email-field-entry").val()=="" ) {alert(app_warning_text);$(".appointments-email-field-entry").focus();return false;}';
        $replace = 'if($(".appointments-email-field-entry").val()=="" ) {$(".appointments-email-field-entry").val("anonymous@appointment.com");post_data.app_email="anonymous@appointment.com"}';
        return str_replace( $search, $replace, $script );
    }

    The first part is okay, so we are talking about second part only :slight_smile:

    Have an awesome day!

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.