kieranbarnes Independent PHP, WordPress & CubeCart Programmer

WP-o-Matic Upgrade Fix

Posted on July 1, 2008

So I rolled out some WP-o-Matic upgrades recently. I was all excited that version 1.0RC3-7 had been released. One upgrade went fine, one freaked out - it would run the cron fine, an improvement on the previous version, but it wouldn't process campaigns. The problem turns out to be the getCampaigns function in wpomatic.php

MaEl reports that the lastactive columb is in timestamp format, whilst the frequency column is in seconds, you need to convert the lastactive date to be UNIX_TIMESTAMP to get the maths to work correctly. What, didn't you spot that yourself?

Replace the following in wpomatic.php

if($unparsed)
$where .= " AND active = 1 AND (frequency + lastactive) < ". current_time('timestamp', true) . " ";

with

if($unparsed)
$where .= " AND active = 1 AND (frequency + UNIX_TIMESTAMP(lastactive)) < ". (current_time('timestamp',1) - ($gmt ? 0 : (get_option('gmt_offset') * 3600))) . " ";

This will solve the issue until the next release.


Related posts

  1. WP-o-Matic fix for WordPress 2.5
    WP-o-Matic makes autoblogging a easy by automatically creating posts from the RSS/Atom feeds you give...
  2. WP-O-Matic Bug Fixes Round Up
    I've run into quite a few issues in the latest 1.0RC3-7 release of WP-O-Matic. Here's...
  3. WordPress WP-O-Matic Duplicate Posts Fix
    Got a problem with WP-O-Matic creating duplicate posts? Or just WordPress in general. Me too....
  4. WP-O-Matic Cron Hangs
    Does your WP-O-Matic hang sometimes when processing feeds? It's probably trying to a ping back...
  5. Looping over dates in PHP
    I recently had to loop over the difference between two dates. For example to create...

Posted by Kieran


Tagged as: Leave a comment
Comments (1) Trackbacks (1)
  1. Fixed a couple 1.0RC3-7 this way- works great, however, 1.0RC4-6 which seems to include the fix does NOT work- CRON apparently runs but nothing processed. Ideas??


Leave a comment

(required)