Support Forum

SP Stats Interval

RJ Rajinder Johal
Rajinder Johal
Member

Hi guys

I was wondering, I have stats interval set to 1 (3600) but I am actually having to manually run the cron hook so that the forum displays the stats properly, is there any way to set the stats to update say after a new member joins? or even set it to run every 10mins ? even set to 1 hour its not updating.

14 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

You can’t set them to less than 1 hour in the UI I am afraid.
But let’s get them running properly anyway. It is possible that they have become ‘unscheduled’ so could you try deactivating SP and then reactivating it which should re-enable the cron schedules.

RJ Rajinder Johal
Rajinder Johal
Member

1 hour would be fine to be honest, but at the moment I’m having to manually run the cron hook, I have deactivated and reactivated the plugin, the cron schedule is there allright

 

forum.predatornutrition.com

MP Mr Papa
Mr Papa
Member

if you deactivated and reactivated, time to see if your site is properly running the wp cron stuff…  go create a wp blog post and schedule it to be published in 15 mins… and see if it appears…

RJ Rajinder Johal
Rajinder Johal
Member

Hi Guys

Ran a post schedule for 15 mins as advised and it appears as “missed schedule” obviously cron jobs aren’t working correctly on the site then? How would I rectify this ?

MP Mr Papa
Mr Papa
Member

so time to head over to the wordpress.org support forums and check the topics there (is a bunch) on issues with wp cron not running…

RJ Rajinder Johal
Rajinder Johal
Member

apparently my host does not allow loopbacks, even using the alternate chron in wp-config

define(‘ALTERNATE_WP_CRON’, true);

Makes no difference, thanks for the help anyway.

MP Mr Papa
Mr Papa
Member

a shame…  thought there was some other workarounds for the silly, restrictive hosts…

If you want, I can give you some code to add which will force the stats to run on every page load so they are up to date…  just adds a bit of processing to every page…

RJ Rajinder Johal
Rajinder Johal
Member

Hi Mr Papa, they did say if I upgrade to a VPS they would take off the restriction as it would be my own server.

 

yeahh sure I would appreciate the code, would the processing be heavy?

MP Mr Papa
Mr Papa
Member

It shouldnt be too bad… try it and see…

in your sp theme spFunctions.php template file, add this

add_action(‘sph_forum_startup’, ‘spx_my_stats’);
function spx_my_stats() {
     sp_cron_generate_stats();
}

and see if that gets it…

RJ Rajinder Johal
Rajinder Johal
Member

Thanks, just added the code I will see if it works 🙂

RJ Rajinder Johal
Rajinder Johal
Member

Great Job, that bit of code worked a treat, thanks very much.