Appointments+ Eliminate Calendar Altogether

Hey guys.

So I know full well that this is outside of "regular" support, but I'd appreciate a little help -- from support, from the community, from whomever feels qualified. :slight_smile:

Because my service providers have extended profiles which customers can search, I've created a custom search engine and booking system using App+ as the base. I'm pretty happy with it, but because I'm dependent on shortcodes, I have to display a clickable calendar AFTER the customer has entered their search date and time.

I've managed to compile everything into an array that seems to match the arguments appointments_insert_appointment requires:

user: 106
name: JBDtest
phone: Array
address: 445 W. 54th St #5A, Array
city: New York, NY 10019
worker: 79
price: 15
date: 2016-04-16
time: 22:00
created: 2016-04-12 11:43:26
note: Notes: ** Lessons Requested: piano ** Borough: manhattan ** Neighborhood: midwest
status: pending
duration: 60

I have left "service" blank because I'd rather not require a specific service, but I can sort that out if I have to, also.

I'd hoped that just including the "class-app-appointment.php" file and calling the function with a click would do it... but, alas (and no surprise), no luck.

Obviously, the goal is to have the user click a "Book Now" button and to have the appointment book and the PayPal charge be processed, etc.

  • Ivan Shulev
    • The Bug Hunter

    Hey jamesdonegan ,

    I hope you are having a nice day so far!

    I can't give you a concrete answer, but I would like to share the approach I would take.

    I would monitor the database queries when an appointment is created and would also look through plugin files to find exactly the files that call these queries. It also helps to get a good understanding of the plugin logic and flow.

    I would ask you to send me your custom array generating file to test and give you a more concrete answer.

    You can send it through our previous email correspondence or attach it here.

    Thank you and I wish you an awesome day ahead!


  • jamesdonegan
    • The Incredible Code Injector


    I've scoured the plugin files, and I see the functions. But just calling them and sending the arguments doesn't seem to work.

    I've really only tried appointments_insert_appointment

    I'm attaching, with my two search files "content-sitter-search-test.php" and "content-display-page-sitter-profile-test.php"

    I'm sure the code is a little messy to someone who codes as much as you do, but hopefully it's not too hard to follow (makes sense to my brain). The deal is that, with babysitters, the sitter is as important as availability, so the search form finds all of the sitters who are available AND who meet the family's needs, otherwise. Then they click on a profile, and they see more information about that sitter. I'd like them just to be able to click "book now."

    You can see it in action at

    You do have to be logged in to view the sitter's profile, so let me know if you need new credentials (I've sent them before in other direct communication).

    THANK YOU!!!

  • Rupok
    • Support Ninja

    Hi jamesdonegan

    Hope you had a wonderful day.

    I've pinged our SLS team as Kasia Swiderska has already flagged them. And I believe, they will come up with some workaround very soon.

    Please keep in mind, our developers work round the clock and they have to deal with lots of critical issues and other things. So it may take a little while for them to check this and provide a feedback.

    Have a nice day. Cheers!

  • Ivan Shulev
    • The Bug Hunter

    Hey jamesdonegan ,

    I was able to include the file and call the appointments_insert_appointment function, as you try in your files. Successfully created an appointment, as a result.

    A few suggestions:
    1. Makes sure the data types of each of the $searchparams array values are the same as the ones of the $defaults array, defined in the appointments_insert_appointment function.

    2. I would enable wp_debug ( and look for errors. Feel free to paste here the contents of the debug file and we will figure it out :slight_smile:

    3. You don't need to set all the values, like specified in the $defaults array. In that array, you can clearly see 'time' => '', // Do not use this one so I would suggest going over $defaults array once more and setting only the needed values (you can skip the 'created' as well)

    4. Instead of hard-coding the plugin file URL, you can locate it with the following: include_once(plugins_url('appointments/includes/class-app-appointment.php'));

    Again, you are more than welcome to post back further questions here. We are happy to help!

    Have an awesome day ahead!


    • jamesdonegan
      • The Incredible Code Injector

      This is a great help, thank you. I seem to be making some headway with your assistance. (Although the include_once form gave me an error, so I had to use $_SERVER['DOCUMENT_ROOT'] )

      I haven't figured out, yet, how to CHARGE them for the service, but this is the first bit of progress I've seen.

      So THANK YOU! I'm leaving this open in case more comes up.

      • Jude
        • DEV MAN

        Hey there jamesdonegan

        An alternative approach would be to instantiate an object of Appointments_Appointment after checking if the class exists and then calling appointments_insert_appointment( $args ); from the instance variable like

        if ( class_exists('Appointments_Appointment') ) : 
        $a = new Appointments_Appointment() ;
        $a-> appointments_insert_appointment( $args ) ; 
        endif ;

        Should protect from filename changes and behaviour of the $_SERVER variable on some hosts.

        • jamesdonegan
          • The Incredible Code Injector

          Thank you so much. It is working great now, but do you think I need to change it up?

          The only thing I haven't figured out is how to change the status of the appointment from "Pending" to "Confirmed" only after payment has cleared PayPal.

          • Jude
            • DEV MAN

            Hi again jamesdonegan

            Here is a snippet that can help with updating the status. Do test before using it

            add_action( 'wp_ajax_post_confirmation', 'app_update_status' );
            add_action( 'wp_ajax_nopriv_post_confirmation', 'app_update_status' );
            function app_update_status() {
            	if( $_POST['payment_status'] == 'Processed' || $_POST['payment_status'] == 'Completed' ) :
            	update_metadata( "app_appointment", $_POST['custom'] , "confirmed"  );
            	endif ;

            Also if it works in your production server Id say leave it as is, if it gives you issues you can always switch back to my alternative approach


          • jamesdonegan
            • The Incredible Code Injector

            Thank you so much for the guidance. Doesn't seem to work, though. I added it to functions.php at the bottom. Made an appointment, successfully posted as "Pending," then ran the payment, which was also successful, but no change to the appointment status.

          • jamesdonegan
            • The Incredible Code Injector

            I'm not sure how to see if the transaction is logged by App+. Where would I find that? I am working on several things with this site so, for now, I'm keeping the status of the new appointment to "Confirmed" until I have chance to work on this and troubleshoot/debug.

          • jamesdonegan
            • The Incredible Code Injector

            Hi best friend, Jude :slight_smile:

            Just an update... this little function is at least being called now, but it seems to generate this email (note that I removed the site url):

            Subject: Appointment status could not be changed
            Paypal confirmation arrived, but status could not be changed for some reason. Please check appointment with ID
  • jamesdonegan
    • The Incredible Code Injector

    Hey hey. Just checking in on this. I also know this isn't good form, but since you actually know my case and my site so well, Jude I wanted to ask if you could look at the service provider's edit profile page. I'm successfully letting them edit their schedules, but for some reason the javascript for the date picker and for adding a second/third/fourth break time aren't loading. Thoughts?

    Here is a video to demonstrate:

    I don't care about the date picker showing up (I know that's browser specific anyway), but I do care about the date format not correcting the way it does in the admin profile editor.


      • jamesdonegan
        • The Incredible Code Injector

        That is all set properly, as you can see in the form code here:

        <form action="" method="post">
        			<input type="hidden" name="business" value="" />
        			<input type="hidden" name="cmd" value="_xclick">
        			<input type="hidden" class="app_item_name" name="item_name" value="Broadway Babysitter's Commission" />
        			<input type="hidden" name="no_shipping" value="1" />
        			<input type="hidden" name="currency_code" value="USD" />
        			<input type="hidden" name="return" value="" />
        			<input type="hidden" name="cancel_return" value="" />
        			<input type="hidden" name="notify_url" value="<?php admin_url('admin-ajax.php?action=app_paypal_ipn')?>" />
        			<input type="hidden" name="src" value="0" />
        			<input class="app_custom" type="hidden" name="custom" value="" />
        			<input class="app_amount" type="hidden" name="amount" value="<?php echo $price; ?>" />
        			<input class="app_submit_btn" type="submit" name="submit_btn" value="Pay Broadway Babysitters $<?php echo $price; ?> Commission on PayPal" />
        			<img style="display:none" alt="" border="0" width="1" height="1" src="" />

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.