Support Forum

Problem adding/deleting cron for sph_subs_digest_cron

NM Natalya Murphy
Natalya Murphy
Member

I wanted to change the run time for the sph_subs_digest_cron.  Since I didn’t see an edit option, I figured I would add a cron with the new desired run time and then delete the current cron job.  Unfortunately, I can’t see to do either without problems.

First I tried adding the cron using the following field values:

  • Next run timestamp: 1354438860
  • interval: sp_subs_digest_interval
  • hook: sph_subs_digest_cron
  • arguments: (left blank)

The cron shows up in the listing but gives the following message, even though I didn’t supply any arguments: “Warning: Invalid argument supplied for foreach() in /problem-with-post-edit-buttonome/chaohome/public_html/test/wp-content/plugins/simple-press/admin/panel-toolbox/forms/spa-toolbox-cron-form.php on line 105”

Then I tried deleting the old cron by putting in the timestamp and hook and leaving the arguments field blank.  SP claims the cron was deleted but it still shows up in the list.

Ultimately, all I want to do is to get the cron to run at a different time.  So I need to either successfully add/delete the job or find a way to change the next-run time for the current cron.

1 Answer

New Answer

MP Mr Papa
Mr Papa
Member

looks like there is a problem with deleting some crons…  we pass an empty string for args if none… it expects an empty array…  and unfortunately, the wp functions for deleting crons dont return success of failure, so we have to assume success…

will get that fixed up in next version…

if you want to make change yourself, its simple change…  in simple-press/admin/panel-toolbox/support/spa-toolbox-support.php, around line 206, change:

    $delArgs = (!empty($_POST[‘del-args’])) ? sp_esc_str($_POST[‘del-args’]) : ”;

to

    $delArgs = (!empty($_POST[‘del-args’])) ? sp_esc_str($_POST[‘del-args’]) : array();

and you will be able to delete a cron…  as I said, will get it fixed in next version…

probably should make similar change on line 193 for adding crons…

but that said, I cannot duplicate your error with adding… I can add a cron job just fine…  the error indicates issue with args, but as I said cannot duplicate that…  so try the line 193 change and see if that corrects…