Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Digest subscription schedule
Avatar
bauerm
Member
Free Members
sp_UserOfflineSmall Offline
Aug 17, 2012 - 8:39 am

Superiors are requesting the weekly digest subscribers we have be sent the email every Friday at 8AM EST.

I was looking around the plugin files and found this area within sp-subscriptions-plugin.php:

function sp_subscriptions_cron_schedule($schedules) {

$subs = sp_get_option('subscriptions');

$interval = ($subs['digesttype'] == 1) ? (60*60*24) : (60*60*24*7);

$schedules['sp_subs_digest_interval'] = array('interval' => $interval, 'display' => __('SP Subscription Digest Interval'));

return $schedules;

}

I'm stabbing in the dark here, but it seems like the messages are sent 24hrs (for daily) or 168hrs (for weekly) from the time someone subscribes.

Would this (line 657) be the appropriate place to define the release for Fridays @ 0800?

I suppose another, more laborious solution, would be to manually re-subscribe our users (well over 100) as quickly as possible next Friday morning.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 17, 2012 - 9:53 am

If you need something to happen at a precise set time on a periodic basis then you would need to install some sort of scheduling application. There may well be some sort of WP plugin that would do this - it is not something I have ever looked in to.

Meanwhile we have CRON and the WP CRON Scheduler. And this is what the subs digest uses. Yes - this does schedule an event to take place at a set time and date. But... it IS dependent upon a user visiting the site. So - if nobody happens to be loading a page from the site at the specified time the event will wait until someone does. This makes it hard to be precise of course. But it is how it works.

But you can get close by setting the scheduled time of the next event to be more or less when you want it to happen. But I am not actually sure of the best way to to do that and will need to get some advice although it might be discussed in the WP codex.

andy-signature.png
YELLOW
SWORDFISH
Avatar
bauerm
Member
Free Members
sp_UserOfflineSmall Offline
Aug 17, 2012 - 10:27 am

Interesting info Yellow Swordfish; I forgot about that section in the Toolbox.

After poking around the Codex a bit (the search system in there leaves much to be desired btw) there doesn't seem to be much of anything posted about the Toolbox, let alone CRON.

If I understand you correctly, someone must be logged into the forum before any CRON hook will run?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Aug 17, 2012 - 10:52 am

No quite right. It just needs a visitor to the site and they do not have to be logged in. Any visitor, any page and if a task is scheduled and not yet run then it will be actioned.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17363
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625