Archived

This topic is now archived and is closed to further replies.

  • 0

PageLines Blocking Cron Job?


Question

Posted · Report post

Hi everyone. I hope someone will be able to help me with this situation; I'm happy to provide any clarification or additional information needed!

 

I'm using CiviCRM with my PageLines/WP install and have been having issues sending group emails (that's not what I'm asking for help with here, just laying the groundwork a bit to give context). The key to getting the plugin to send the emails seems to be having the cron job on my server fire correctly. I've set up a cron job using wget which should work but doesn't. The test for this is to try the URL I'm using for the wget directly in my browser, but when I do, I get the following error message: 

 

Fatal error: Call to a member function pagelines_register_sections() on a non-object in /home/go9anpf/public_html/wp-content/themes/pagelines/includes/class.sections.php on line 79

 

Searching the PageLines forums for a fix, I found this post:

 

http://www.pagelines.com/forum/topic/25739-civicrm-pagelines-no-cron/ 

 

Trying the crm.php code Simon so helpfully listed in the above post did not change anything for me. To be clear, I'm on the following:

 

PageLines 4.2.1 (Base Theme)

CiviCRM version: 4.2.6

CMS version: WordPress 3.5.1

MySQL version: 5.1.68-cll

PHP version: 5.2.17

 

The more I try to work through this, the deeper it seems to go. Any help or advice (geared toward an advanced-novice level front-end developer) would be much appreciated!

Share this post


Link to post
Share on other sites

15 answers to this question

Posted · Report post

Do you have Contact7 active on your site? Or any contact form plugins?

 

This was interesting:

http://forum.civicrm.org/index.php?topic=27077.0

 

And it seems to be a common topic on their forum:

http://forum.civicrm.org/index.php?topic=24751.0

 

They have a list of available experts you can call upon that may be able to help you set this up properly:

http://civicrm.org/what/experts

 

I hope this helps!

Share this post


Link to post
Share on other sites

Posted · Report post

Where did you put the code?

Share this post


Link to post
Share on other sites

Posted · Report post

I created a file called crm.php and put the exact code as listed in your post into that file. I then put that file in /wp-content/plugins/

Share this post


Link to post
Share on other sites

Posted · Report post

In that case it's in the wrong folder mu-plugins NOT plugins Sent from my iPad using Tapatalk HD

Share this post


Link to post
Share on other sites

Posted · Report post

I have no mu-plugins folder in wp-content; should I create one?

Share this post


Link to post
Share on other sites

Posted · Report post

I have no mu-plugins folder in wp-content; should I create one?
Yes Sent from my iPad using Tapatalk HD

Share this post


Link to post
Share on other sites

Posted · Report post

Okay. Just did that and got this error, sitewide:

 

Fatal error: Class 'Fix_CRM_Cron' not found in /home/go9anpf/public_html/wp-content/mu-plugins/crm.php on line 20

Share this post


Link to post
Share on other sites

Posted · Report post

Did you add

 

define( 'CRMCRON', true );

 

to the cron.php as well?

Share this post


Link to post
Share on other sites

Posted · Report post

Hi James. This is exactly what is in crm.php (copied from the Simon's code in the post linked above):

<?php
// Add this to wp-content/mu-plugins/crm.php

if( class_exists( 'CRM_Utils_System_WordPress' ) ) {
  class Fix_CRM_Cron extends CRM_Utils_System_WordPress {
		
		function __construct() {
			if( ! defined( 'CRMCRON' ) )
				return;
			add_filter('template', array( &$this, 'change_theme') );
			add_filter('option_template', array( &$this, 'change_theme') );
			add_filter('option_stylesheet', array( &$this, 'change_theme') );
		}
		function change_theme() {
		    // Alternate theme
		    return 'twentyten';
		}	
	}
}
new Fix_CRM_Cron;

As you can see, define( 'CRMCRON', true ); is not part of the code.

 

Where would I add that line?

 

Thanks!

Share this post


Link to post
Share on other sites

Posted · Report post

Gotcha. No, I had not added that. I just did and got the following sitewide error:

 

Fatal error: Class 'Fix_CRM_Cron' not found in /home/go9anpf/public_html/wp-content/mu-plugins/crm.php on line 20

Share this post


Link to post
Share on other sites

Posted · Report post

Hi,

 

Are you using this plugin? http://civicrm.org/blogs/jag/wordpress-civimember-role-sync-plugin

 

Also, I've dealt with CiviCRM before with WP.  There are several issues with it that crop up from time to time.

 

From my experience, often when errors are thrown by the system, they point to PageLines Framework, but in fact, the errors have nothing to do with the Framework itself. It's just that it happens within the view of the Framework, so the error is displayed that way.

 

From the looks of that error, my guess is that the cronjob should in this case, be outside the WP structure, since it's calling upon the server's mail function, not a WP function.  To support this, read this Drupal related article:  http://altinukshini.wordpress.com/2011/08/01/civicrm-civimail-cron-job-setup/ as it describes the need to put the cron in the server root.

 

CiviCRM should provide you with support for setting up a cronjob for mail and I believe this topic may point you in the correct direction:  http://book.civicrm.org/user/current/initial-set-up/scheduled-jobs/.

 

This Wiki from their site may also help:  http://wiki.civicrm.org/confluence/display/CRMDOC43/CiviMail+Installation

 

Unfortunately, this cron task is something that should be supported directly by CiviCRM as PageLines isn't going to block any cron task set up properly outside the parameters of WordPress.

 

Hope this helps!

Share this post


Link to post
Share on other sites

Posted · Report post

Hi OSE,

 

Thanks for your support on this. I'd gathered from Simon's post that the way CiviCRM has set up the cron.php file that it's needlessly complicated and calling a version of the theme within which to authenticate the login info on the wget process, so I do understand this is really CiviCRM's issue to help me resolve. Unfortunately, though I've posted this issue in their community forums, there's very little in the way of activity and support there for people using CiviCRM on WordPress, so I've not received any real support.

 

Regarding your specific points:

- I'm not using the plugin you reference. There's no connection between my CiviCRM contacts and my WP registered users, so I don't believe I have a need for it. Am I missing something here?

- The Drupal article is interesting. I'm essentially looking for this same kind of solution, but for WordPress. I'm not a coder, so I'm unable to create this myself.

- I am very familiar with the CiviCRM documentation for installation and configuration of CiviMail and for setting up cron job; thanks! Those pieces would be working perfectly if not for the error message created when the wget attempts to authenticate login...

 

I appreciate the PageLines community more and more every day. Many thanks for taking the time to provide all this support.

Share this post


Link to post
Share on other sites

Posted · Report post

I did have Contact Form 7 active, but deleted it after reading about it conflicting with cron job. Deleting that plugin has not helped my situation.

 

It is indeed a very common topic; clearly the integration of CiviCRM and WP is less than stellar at this time -- unless your WP install is very basic.

 

Thanks for the link to the expert firms; that will most likely be my next direction I head in.

 

Having someone else to knock these things around with is always a big help! Thanks very much!

Share this post


Link to post
Share on other sites

Posted · Report post

You're very welcome.  Let us know how it goes!

Share this post


Link to post
Share on other sites