Okay
  Public Ticket #3702058
Cron Event
Closed

Comments

  • Thomas started the conversation

    I submitted a previous ticket about the cron job. I am submitting a separate ticket per your request. 

    I have contacted my hosting provider and they said they could not help me. I tried the set it up again in WP Control and it didn't work again.

    This has gotten to a point where I had to hire someone to fix this problem because it is not working. They created a plugin so that the cron job will work as intended. Here is the code they created:

    <?php

    // Exit if accessed directly
    if (!defined('ABSPATH')) {
        exit;
    }

    // Schedule the cron job
    function appointment_reminder_schedule_cron() {
        if (!wp_next_scheduled('appointment_reminder_cron_job')) {
            wp_schedule_event(time(), 'appointment_reminder_interval', 'appointment_reminder_cron_job');
        }
    }
    register_activation_hook(__FILE__, 'appointment_reminder_schedule_cron');

    // Clear the cron job on plugin deactivation
    function appointment_reminder_clear_cron() {
        $timestamp = wp_next_scheduled('appointment_reminder_cron_job');
        wp_unschedule_event($timestamp, 'appointment_reminder_cron_job');
    }
    register_deactivation_hook(__FILE__, 'appointment_reminder_clear_cron');

    // Add custom interval
    function appointment_reminder_custom_cron_schedule($schedules) {
        $schedules['appointment_reminder_interval'] = array(
            'interval' => 5 * 60,
            'display'  => __('Every 5 Minutes'),
        );
        return $schedules;
    }
    add_filter('cron_schedules', 'appointment_reminder_custom_cron_schedule');

    // Cron job function
    function appointment_reminder_cron_function() {
        $url = 'https://{{website}}.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/notifications/scheduled/send';
        wp_remote_get($url);
    }
    add_action('appointment_reminder_cron_job', 'appointment_reminder_cron_function');

    // Add author link
    add_filter('plugin_row_meta', 'appointment_reminder_plugin_row_meta', 10, 2);
    function appointment_reminder_plugin_row_meta($links, $file) {
        if (plugin_basename(__FILE__) === $file) {
            $author_link = 'Author';
            $links[] = $author_link;
        }
        return $links;
    }

    This is what they have so far, but would like feedback.

    I changed the url to not have my website, but it has it in the plugin.

    Also, this is something that I have had to deal with before. I agree with the comment in this thread (https://wordpress.org/support/topic/need-to-create-command-cron-for-automatic-notifications-with-amelia/) that maybe this is something you all should have built in. I don't use any other scheduling plugins, so I do not know what is standard practice. However, I would imagine that you get a lot of tickets and questions about the cron scheduling that you have users create.

    I do not know what it would take to add it from your end, but I would imagine the work you need to build the cron into your plugin would save all the time you have put in to helping people deal with it. The plugin has been incredible and I really do like it. I even wrote you all a 5 star review, but this has been very difficult for me and I have spent many hours trying to get this resolved with many different people.

    I hope we can figure something out.

    Thank you again for the great plugin that has helped my business grow and saved me a lot of time scheduling.


  •  700
    Stefan replied

    Hi Thomas,

    Thanks for reaching out to us. Just went through your other tickets to get a better overview of the issue you have. Unfortunatelly, this is a "well-known" issue that most of our users have, but it's not related to Amelia. The cron job is used for sending the scheduled notifications, but it's a Linux command, and its a scheduled task. I see that my colleague already sent the instructions on how it should be configured and in 99 percent of cases,  this works. As you may noticed already, this widely depends on the hosting provider settings and configuration, therefore it's not the same cron job for each user. Since I haven't investigated the setup on your site I'm not sure what happened exactly, but I'm reading your message that you were able to find the solution.

    Great to see that. But, for the custom solution of integrating the cron job function in Amelia, it would take a lot of time, development, research, and testing. We already have a roadmap of features that we are working on and this requires a lot of development, already. Anyway, you can suggest this as a feature on our feature suggestion page. Of course, should you have any other questions or issues regarding the other topics, feel free to reach out to us and we will kindly provide assistance.


    Kind Regards, 

    Stefan Petrov
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Thomas replied

    I added this comment to the feature request. I really hope you do this!

    I am not sure what other plugins do, but it seems like this is not something that other scheduling plugins require.

    For example: https://support.vcita.com/hc/en-us
    https://support.vcita.com/hc/en-us/articles/360041604393-Setting-Your-Booking-Reminders-and-Intake-Form
    https://support.vcita.com/hc/en-us/articles/360041409013-Automatic-Client-Messages

    I searced their documentation for “cron” and nothing came up.

    Surely there are several other plugins that do not require users to do this. Just download the plugins of your competitors and see how they do it.

    I have had to hire someone to solve my problem and it is frustrating. I love this plugin, but this feature has caused my so much trouble.

    I really hope you add this feature

  •  700
    Stefan replied

    Hi Thomas,

    Thanks for the suggestion and apologies for the inconvenience. We will of course pay attention to this feature in future updates.


    Kind Regards, 

    Stefan Petrov
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables