2

I updated AddThis for Wordpress 4.0.7 to AddThis Sharing Buttons 5.0.7 and scheduled emails stopped sending. I determined that the cron job was getting a fatal error.

Job path - "https://www.xxxxxx.org/wordpress/wp-content/plugins/civicrm/civicrm/bin/cron.php

Fatal error: Call to a member function getConfigs() on a non-object in /home/xxxxxx/public_html/wordpress/wp-content/plugins/addthis/addthis_addjs_new.php on line 57

Here is a snip from the file that caused the error:

    // We haven't added our JS yet. Or at least better not have.
    $this->_js_added = false;

LINE 57:       $this->_options = $addThisConfigs->getConfigs();

    // Version of AddThis code to use
    $this->atversion = $this->_options['atversion'];

The cron job was referencing a file in our AddThis plugin folder. It seems to me that file and plugin should have nothing to do with sending email from CiviCRM. I am not well versed in how cron jobs work, so any information you can provide would be appreciated. The day that this plugin was updated to the latest version 5.0.7, which included the file shown in the fatal error above, is the day scheduled jobs stopped sending and the cron job started erroring out. I deleted the updated plugin and reinstalled 4.0.7, the known good version, which did not contain that file. Scheduled emails now send.

2

I have seen this error before with this plugin. The CiviCRM cron job will fail if while bootstrapping WP a fatal error is encountered.

My only workaround (besides removing the plugin as you did), is to launch the cron job via wp-cli. See http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs and the section on wp-cli. In this case the flag --skip-plugins can be used to stop the addthis plugin from loading.

  • This is correct. Calling CiviCRM involves bootstrapping the CMS, which in most case means calling plugins. I've found that newer versions of AddThis for WordPress also break the CiviCRM API via REST. – Jon G - Megaphone Tech Jul 8 '15 at 4:40
  • My best guess is that this is a scope issue. $addThisConfigs is not explicitly declared as a global in the plugin loader file. When WP is bootstrapped from within a Civi function it is not global in scope, thus failing to be properly referenced when Class AddThis_addjs_sharing_button_plugin is instantiated. Coleman: perhaps try explicitly declaring global $addThisConfigs at the top of addthis_social_widget.php? – Christian Wach Jul 8 '15 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.