CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • cron job not working on WordPress
Pages: [1]

Author Topic: cron job not working on WordPress  (Read 2429 times)

denishow

  • I’m new here
  • *
  • Posts: 19
  • Karma: 2
  • CiviCRM version: 4.2
  • CMS version: WordPress 3.4.2
  • MySQL version: 5.4
  • PHP version: 5.3.15
cron job not working on WordPress
December 07, 2012, 06:13:26 am
Hi I have WordPress 3.4.2 and CiviCRM 4.2.1 and I can't get the cron job working.

Here's what I think is the correct command with a genericised WordPress URL:

wget -O - -q -t 1 "http://www.mysite.com/wp-content/plugins/civicrm/civicrm/bin/cron.php?name=uuuu&pass=ppppp&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&w=0"


When I call it from the command line on my local dev installation I get nothing back at all. If I then look in the Civi > Admin > Scheduled jobs, there is no indication that anything has run, the log shows nothing and the last scheduled time for the enabled jobs isn't updated. (If I choose Execute Now, it works fine).

On the live site, again it works fine if I invoke something from Admin Schedule Jobs screen (and the log is correctly updated). However there, when I fetch the URL manually from the command prompt or from the cron job, I get

<br />
<b>Fatal error</b>:  Call to a member function add_shortcode() on a non-object in <b>/var/www/vhosts/championrowing.org.uk/httpdocs/wp-content/plugins/contact-form-7/includes/shortcodes.php</b> on line <b>164</b><br />

Now I realise that contact-form-7 is a separate plug-in that I'm using with WordPress, but I'm surprised to see this error here given that the site works fine and the scheduled jobs work fine from the admin screen (and that this doesn't happen on my dev site). So I think this is perhaps a bit of a red herring.

I'm at a loss as to how to debug this. I haven't managed to make the remote PHP debugger work on my dev site.

Any suggestions?

Thanks
Denis

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: cron job not working on WordPress
December 08, 2012, 12:30:04 pm
Disable contact-form-7 and then see if the cron job runs correctly. That plugin may be blocking the cron job.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

denishow

  • I’m new here
  • *
  • Posts: 19
  • Karma: 2
  • CiviCRM version: 4.2
  • CMS version: WordPress 3.4.2
  • MySQL version: 5.4
  • PHP version: 5.3.15
Re: cron job not working on WordPress
December 10, 2012, 07:52:12 am
OK, so with some skepticism, I disabled Contact Form 7 to see if this would change anything... and it did!

Unfortunately, I need Contact Form 7 as I have several contact forms on the site. So I Googled

Call to a member function add_shortcode() on a non-object in contact-form-7/includes/shortcodes.php

And found this: http://wordpress.org/support/topic/plugin-contact-form-7-cf7-shortcode-error

It turns out that if you modify the file [wp dir]/wp-content/plugins/contact-form-7/includes/shortcodes.php as follows

Before
$wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();

Insert
global $wpcf7_shortcode_manager;

The cron job now works fine.

So thanks for the suggestion
Denis

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • cron job not working on WordPress

This forum was archived on 2017-11-26.