How to do Appointments Extending

I would like to do some plugin extending to get some site specific changes to the Appointments+ plugin.

For example, display/hide and validate/ignore the additional fields I created based on the user's selection of service. I can do it by changing the plugin core files, for example like this:

In appointments.php line 1639

change this:
do_action('app-additional_fields-validate');

to this:
if (($service == 1) || ($service == 3)) {
do_action('app-additional_fields-validate');
}

But, I don't want to do that. I would rather just add a hook or filter in the functions.php file. I have tried various ways to use remove_action and add_action, but not yet been successful.

So, what is the correct/best way of doing that?

Thanks.

  • Jude

    Hey @Michael Kaplan

    Can you first remove_all_actions() on the app-additional_fields-validate before doing the validation ?

    remove_all_actions( 'app-additional_fields-validate' , 1 ) ; 
    
    ajax_funtion($service) {
    if (($service == 1) || ($service == 3)) {
    do_action('app-additional_fields-validate');
    }
    }

    Then if the validation conditions are met ( inside a different function ) simply call the action again ?

    Cheers
    Jude

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.