Appointments+ app_footer_scripts Not Working

Hi,

I have Appointments+ v 1.5.7. I am trying to redirect a user to a thank you page instead of showing the JS alert box. However, it does not redirect.

I have added the following code into my functions file:

function whc_appplus_redirect( $script ){

echo ‘Hello World!’;

$thanks_page = site_url(‘/booking-confirmation’:wink:;

return str_replace(“window.location.href=app_location()”, “window.location.href='”.$thanks_page.”‘”, $script);

}

add_filter( ‘app_footer_scripts’, ‘whc_appplus_redirect’ );

Also, for debugging purposes, I have temporarily edited the appointments.php file as follows:

function wp_footer() {

$script = ”;

echo ‘
Pre filter:
‘;

var_dump($this->script);

$this->script = apply_filters( ‘app_footer_scripts’, $this->script );

echo ‘
Post filter:
‘;

var_dump($this->script);

if ( $this->script ) {

$script .= “<script type=’text/javascript’>”;

$script .= “var appDocReadyHandler = function($){“;

$script .= $this->script;

$script .= “};”;

$script .= “jQuery(document).ready(appDocReadyHandler)”;

$script .= “</script>”;

}

echo $this->esc_rn( $script );

do_action(‘app-footer_scripts-after’:wink:;

}

If you look at the bottom of the “book appointment” page you will see the output of all of this: http://chirowh.roderickpughmarketing.com/make-an-appointment/

It seems to me that there is no “window.location.href=app_location()” in the script to be changed by the new function. Therefore, the before and after versions of the script are the same.

Have I got a setting wrong somewhere on the settings panel or should the filter function be looking for something different or am I missing something else?

Many thanks!

Ian