Appointments+ Cleanup

Hello
We have been using this plugin for about 2 years now and it has been very successful. The success itself has now kind of turned into an issue (performance). We have over 12,500 completed appointments. We only have 100 - 150 active appointments at any time and it is now taking 2 - 3seconds for the appointment timeslots to load. Remove appointment takes a full 10 seconds to be removed. I have downloaded the old appointments into an excel file and would like to delete the appointments.

1. Is it possible to add a delete button on the Completed tab. It is currently available only on the Removed tab
2. Could you please provide a clean up sql that I could execute on the server to remove both the appointments along with custom field data so I can get better user experience.

In addition, can you please let me know how I can change the Remove checkbox into a button? It is quite an eye sore compared to the rest of the application. Not sure why the developer chose a checkbox when it auto-submits. I would understand if I was able to select multiple appointments and submit for cancellation but if each cancellation is submitted individually, wouldn't a button make better sense?

Thanks in advance
Vamsi

  • Rupok
    • Support Ninja

    Hi Vamsi,

    So sorry for the inconveniences you are having. Let me describe one by one.

    it is now taking 2 - 3seconds for the appointment timeslots to load. Remove appointment takes a full 10 seconds to be removed

    This is really weird and should not happen. I could tell you better about the issue if I could see it live, check your current configuration and make some tests on your site. Would you mind allowing Support Access so we can have a closer look at this?

    To enable support access you can follow this guide here:
    http://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Please confirm here when you are done granting Support Access. Moreover, can you please turn on debug mode in WordPress and then try to remove one appointment? To enable it, open your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:

    define('WP_DEBUG', true);

    In order to enable the error logging to a file on the server you need to add yet one more similar line:

    define( 'WP_DEBUG_LOG', true );

    In this case the errors will be saved to a debug.log log file inside the /wp-content/directory.

    Depending on whether you want your errors to be only logged or also displayed on the screen you should also have this line there, immediately after the line mentioned above:

    define( 'WP_DEBUG_DISPLAY', false );

    The wp-config.php is located in your WordPress root directory. It’s the same file where the database configuration settings are. You will have to access it by FTP or SFTP in order to edit it.

    Past errors here. If file is very long, paste them to a text file and attach with your reply.

    1. Is it possible to add a delete button on the Completed tab. It is currently available only on the Removed tab

    I'm afraid, delete button is not currently available under the Completed tab. You have to mark your target appointments as "Removed" first and then delete those from the "Removed" Tab.

    But this sounds to be a nice idea to me. So I'm moving your thread to our Features and Feedback section. More people liking this idea, more chances our developers will work on this and will include this feature in our future releases.

    2. Could you please provide a clean up sql that I could execute on the server to remove both the appointments along with custom field data so I can get better user experience.

    I've pinged one of our SLS (Second Level Support) staff to check this. I believe, he will come up with his valuable feedback on this very soon. We will update you as soon as we get anything from him.

    Please keep in mind, our SLS staffs 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.

    can you please let me know how I can change the Remove checkbox into a button?

    I'm really sorry but I'm not sure which section you are referring to. Can you please provide a screenshot so we can be clear about your requirement? I'll talk to our developer regarding changing that checkbox to button after I'm confirmed about which section we are talking about. I'm looking forward to hearing from you and resolving this issue as soon as possible.

    Please let us know if you have any confusion or any further query. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

  • Rupok
    • Support Ninja

    Hi Vamsi Pulavarthi,

    Thanks for the screenshot. I'm forwarding this to our developer right now. I believe, he will take this in consideration while working for our future releases.

    Regarding your clean up query, I've got an update from our developer. You should put this snippet in your currently active theme's "functions.php" file and save.

    add_action( 'wpmudev_appointments_update_appointment', function( $app_id, $args, $old_appointment ){
        global $wpdb;
        if( ! isset( $args['status'] ) || $args['status'] != "removed" ) return;
        $apps_table = appointments_get_table( 'appointments' );
        $apps_meta_table = appointments_get_table( 'appmeta' );
        $wpdb->query( $wpdb->prepare( "DELETE FROM {$apps_table} WHERE ID=%d", $app_id ) );
        $wpdb->query( $wpdb->prepare( "DELETE FROM {$apps_meta_table} WHERE app_appointment_id=%d", $app_id ) );
    }, 10, 3 );

    And when clean-up is done, you should remove this from the functions.php file or it will keep cleaning your removed appointments.

    Please NOTE, I'll suggest you to create a complete backup of your site and database before doing this so you can always revert back to current state if anything goes wrong. What this function will do is totally one way and there is not way of getting back the deleted data. And it will totally remove all "removed" appointments from the database. So proceed with caution.

    Please let us know how it goes. If it doesn't work as expected, we will be glad to investigate further.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.