Support Forum

Birthday Plugin

22 Answers

New Answer

PA patrick182
patrick182
Member

My servers and myself are both located in Los Angeles, as indicated in both wp and sp settings. The issue still persists so I just removed the birthdays plugin.

MP Mr Papa
Mr Papa
Member

did a quick test and seems to be working properly… but will try to dig in deeper today and see if I can recreate under any other circumstances…

is your server handling daylight savings time?  Asking because not all do so… not sure if one hour delta could cause it either, but collecting info…

GO gorky5
gorky5
Member

I hope it’s OK to resurrect this thread.

I’m running the Birthdays forum plugin. Because the cron task runs just once a day, the stats in the forum footer are often out of date for users.

For example, it was my birthday yesterday. I’m in the UK, and my SP profile has my timezone set to Europe/London. My server is in Chicago so I’ve set the timezone to that in WP general settings.

This morning (UK time) the forum stats were still showing today as my birthday (when the cron task last ran at 00:01 Chicago time, it probably still was). I had to manually run the sph_birthdays_cron hook to get it to update and show the correct information, but obviously I can’t do that every morning.

I tried deleting sph_birthdays_cron in the Cron Inspector, so I could add it manually with an hourly interval, but before I could do so Simple Press automatically recreated a new task with the same once-daily schedule.

What can I do about this? If I can’t change it, can I request an update to the Birthdays plugin that increases the cron task frequency? Ideally I’d like it to run hourly, so the information is correct for users all around the world.

YS Yellow Swordfish
Yellow Swordfish
Member

On the basis that it is always tomorrow or yesterday somewhere then this seems like a totally reasonable thing to do.
I will open a ticket to get it changed for the next update.
If you want to change it yourself I can tell you what to edit.

GO gorky5
gorky5
Member

Wow, thanks Andy! That’s great news.

If you could share the code changes I’d be happy to edit the file myself (and others could do the same while we’re waiting for the next plugin update).

YS Yellow Swordfish
Yellow Swordfish
Member

There are two files you will need to change. First:

/wp-content/sp-resources/forum-plugins/birthdays/sp-birthdays-plugin.php

fairly near the bottom you will find the function defined:

function sp_birthdays_scheduler()

within that function and in the call to the WP function wp_schedule_event(), change the ‘daily’ to ‘hourly’.

and /wp-content/sp-resources/forum-plugins/birthdays/sp-birthdays-install.php

You will see here 2 uses of the ‘daily’ keyword. Just change them both to ‘hourly’.

After you make and save the changes then deactivate the Birthdays plugin (NOT Uninstall). Then after the page has reloaded – activate it again. This should reset the CRON task bit do check on the toolbox to make sure it has.

GO gorky5
gorky5
Member

Thank you! Very good of you to take the time to write this all out.

Here’s the info from the Cron Inspector:

28 April 2015 – 12.01am 1430179260 Once Hourly sph_birthdays_cron

I assume it won’t update again until 12.01am tomorrow, but from then on it’ll do it hourly. Is that correct? I’m fine with that.

YS Yellow Swordfish
Yellow Swordfish
Member

Ah – it does look that way. Had overlooked that.