Found cron bug in Newspaper 8.1

Posted in: Newspaper
Post count: 388

Hi folks,

I know you’ve had a couple of threads like this already: this one and this one, for example.

I just had the same issue, and decided to investigate cron schedules. Sure enough, by page load, all custom cron schedules are wiped out except for the “three_days” one that Newspaper adds.

The issue is in your cron schedule filter.

In td_js.php in the constructor for td_version_check you add the filter:


add_filter( 'cron_schedules', array($this, '_schedule_modify_add_three_days') );

Here is your callback:


function _schedule_modify_add_three_days() {
    $schedules['three_days'] = array(
        'interval' => 259200, // 3 days in seconds
        'display' => 'three_days'
    );
    return $schedules;
}

As you can see, you are missing the $schedules parameter. This would bring it in line with WP’s reference for the filter.

(Ironically, in version 7.8.1, this filter with the same bug appeared in td_cake.php. In 8.1, td_cake.php has the correct filter but the file is commented out. I guess you lost track of this bugfix!)

Temporary fix for other users: Either modify the theme file directly by pasting this code into Newspaper/includes/wp_booster/td_js.php … or set any add_filter calls for the cron_schedules hook to priority 11 or greater so that they take place after the one in td_js.

Post count: 11

Thanks, now I know why some plugins that are using cron schedules not working with 8.0 and 8.1

https://forum.tagdiv.com/topic/plugin-confict-n8-and-n8-1/

Post count: 81

Cool thanks.

Post count: 8

Silly question, but is there a way to edit the td_js file from within the WordPresss admin console? I don’t see that file in the theme editor.

Post count: 23312

Hello cryptodesk,

You should update the theme to the latest version of it because now you can edit more theme’s files from there as you can see here -> https://www.screencast.com/t/H762HxtDz8qF

Hope this helps!

Thanks for the message!

Post count: 16

FYI:
We had an issue in Newsmag 4.2 with the cron job trying to get processed a few seconds in the past, therefore it didn’t really run every 5 minutes.
We are trying to fix it adding a line in config.php following the instructions here:
https://codecanyon.net/item/scrapes-web-scraper-plugin-for-wordpress/18918857/faqs/29845
… now sometimes we get the time right (cron programed in the future) , sometimes it is wrong again.

  • This reply was modified 8 years by domino.
Post count: 388

Hi,

This fix is still needed in Newspaper 8.6.

The solution is still the same.

Please update it in the theme files for the next version!

Viewing 7 posts - 1 through 7 (of 7 total)
The forum ‘Newspaper’ is closed to new topics and replies.