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 »
  • Installing CiviCRM »
  • WordPress Installations (Moderators: Kurund Jalmi, Coleman Watts) »
  • cron job issue with wordpress site
Pages: [1]

Author Topic: cron job issue with wordpress site  (Read 2249 times)

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
cron job issue with wordpress site
November 18, 2012, 01:08:47 pm
I'm struggling to get the CiviCRM cron job working on a wordpress site. I get the following error:

Code: [Select]
Fatal error: Call to undefined function is_admin() in /home/user/public_html/example.com/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php on line 49
On a clean install I can't replicate this issue. The function is_admin() looks to be defined in wp-includes/load.php

There is a relevant issue at http://issues.civicrm.org/jira/browse/CRM-9727 which suggests the problem was fixed in 4.1.1 but I'm still getting it.

In my case the wordpress install is non-standard in that the wp-content directory, and all that one might expect it to contain including plugins/civicrm, is where one would generally expect it to be, but the rest of the wordpress codebase is in a directory within the root directory, called 'cms'. This is where CiviCRM has been told it is. Everything else seems to work fine with this arrangement, but I'm wondering whether this might be the cause of my cron failure woes, as that script is being called externally as it were.

So my assumption is that the cron job will only run if the wordpress codebase is all structured as it would be with a clean install.

Am I barking up the wrong tree?

If my fears are confirmed, what are the options (if any) if I don't want to revert to a standard wordpress directory structure?

Thanks for any input on this.
Graham Mitchell
http://mc3.coop

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 issue with wordpress site
November 20, 2012, 08:44:38 am
To test your hypothesis, put the one file wp-includes/load.php in where you think CiviCRM expects it be. Then we can see if indeed you are barking up the right tree. :)
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.

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: cron job issue with wordpress site
November 20, 2012, 02:29:36 pm
Thanks Hershel

I gave that a go, but to no effect. Looking at the log file I do get the following:

Code: [Select]
Nov 20 22:24:36  [info] $Fatal Error Details = Array
(
    [message] => Could not find the install directory for WordPress
    [code] =>
)

Nov 20 22:24:36  [info] $backTrace = #0 /path/to/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(312): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 /path/to/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php(359): CRM_Core_Error::fatal("Could not find the install directory for WordPress")
#2 /path/to/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/WordPress.php(291): CRM_Utils_System_WordPress->loadBootStrap("user", "password")
#3 /path/to/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(576): CRM_Utils_System_WordPress->authenticate("user", "password", TRUE, NULL)
#4 /path/to/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Utils/System.php(538): CRM_Utils_System::authenticate("user", "password", TRUE)
#5 /path/to/wordpress/wp-content/plugins/civicrm/civicrm/bin/cron.php(34): CRM_Utils_System::authenticateScript(TRUE)
#6 {main}

(I've edited the paths and replaced the correct username and password with placeholder values to protect the innocent).

This suggests that WordPress.php is failing to correctly identify the location of the Wordpress codebase. As noted above, my Wordpress file locations are non-standard in that they are not in the default locations, but are implemented according to accepted practice as set out in the Wordpress Codex. (http://codex.wordpress.org/Editing_wp-config.php#Moving_wp-content).

Is WordPress.php capable of working with non-default file locations in the WP install?
Graham Mitchell
http://mc3.coop

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: cron job issue with wordpress site
November 20, 2012, 07:23:55 pm

pretty sure wordpress.php is NOT capable of dealing with the non-default installation of civi / wp

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: cron job issue with wordpress site
November 21, 2012, 03:29:41 am
Thanks for the input.

That's a shame given that alternate file/directory layouts are a fairly commonly used feature of Wordpress.

Assuming WordPress.php is the problem here, might the same issue also be the reason why I can't expose profiles, event pages/forms and contribution pages on my WP site?
Graham Mitchell
http://mc3.coop

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: cron job issue with wordpress site
November 21, 2012, 08:20:44 am

dont know, but might potentially be the reason.

might be worth to get a site working under the default install also and then see what works there and what does not work in an alternate layout

i suspect support for alternate layouts are not too hard. Can you take a look at the code and contribute a patch for this

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: cron job issue with wordpress site
April 09, 2013, 02:28:18 am
We are still struggling with this problem of a non-standard Wordpress file/directory layout. I'm willing to pay for some professional input on this one to get it resolved. Changing to a standard directory structure is not necessarily a viable option as that will create a whole new set of issues. If anyone can help on this please let me know.
Graham Mitchell
http://mc3.coop

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: cron job issue with wordpress site
April 09, 2013, 06:46:39 am

I suspect this is a 5-10 hour project. If your client has the funding for this, let us know and we can take a look. Ping us on irc if you have any questions

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: cron job issue with wordpress site
April 09, 2013, 06:52:29 am
Thanks Lobo

I'm potentially able to fund this work to some degree, and my client may well be able to support that with some further resources.

Would the work produce an outcome such that CiviCRM could be configurable to cope with a number of non-standard WP set-ups? This could be a useful contribution, and not simply solve our particular use case.

Let me know what 5-10 hours would cost and I'll happily consult with my client.

Best wishes
Graham
Graham Mitchell
http://mc3.coop

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: cron job issue with wordpress site
April 09, 2013, 06:56:40 am

hey graham:

rates and contract here:  http://wiki.civicrm.org/confluence/display/CRM/CiviCRM+Consulting+Rate+Sheet

yes, we'll try to follow WP best practices with regard to this to handle different situations

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Upperholme

  • Administrator
  • Ask me questions
  • *****
  • Posts: 568
  • Karma: 8
    • MC3
  • CiviCRM version: 4.x
  • CMS version: Drupal 6.x/7.x, Wordpress, Joomla
Re: cron job issue with wordpress site
April 12, 2013, 12:45:49 am
Hey Lobo

Great news.

I've sent you an email with some further details so that we can move this forward.

Here's to a more resilient CiviCRM.
Graham Mitchell
http://mc3.coop

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • WordPress Installations (Moderators: Kurund Jalmi, Coleman Watts) »
  • cron job issue with wordpress site

This forum was archived on 2017-11-26.