Today I am testing the CiviCRM 4.1 beta 3 release on WordPress. On WordPress, you may ask? For those who are already CiviCRM users, you may be as surprised as I was to see it becoming available as a WordPress plugin. Until recently, you could only run it on Drupal or Joomla. You can read the CiviCRM blog for more information about CiviCRM 4.1 beta 3.
I'm running on Windows 7 right now for kicking the tires, as it were. I had to do a couple small changes to get it going, so I am sharing them below:
1. Writable directories and files
On the WordPress Installation Guide for CiviCRM 4.1, you'll see the error mentioned "The user account used by your web-server needs to be granted write access to the following directory..." and a link to the CiviCRM forums. The suggested fix to change the read-only flag on the directories and files did not work for me, using the GUI or command line on Windows 7 (as administrator or not as administrator).
The workaround that allowed me to continue was to comment out the checking for writable directories in the /plugins/civicrm/civicrm/install/index.php lines 368 to 370:
foreach ( $writableDirectories as $dir ) { /*$this->requireWriteable( CIVICRM_DIRECTORY_SEPARATOR . $dir, array("File permissions", "Is the $dir folder writeable?", null ), true );*/ }
2. Fix an HTTP Error 500 Internal Server Error
I clicked the CiviCRM install button and everything seemed to be running. But, clicking "CiviCRM" on the sidebar, I got an HTTP 500 error. Uh oh. Nothing specific was mentioned in the web server logs as to why. After some trial and error, I fixed it by editing the civicrm.settings.php file. $civicrm_root and CIVICRM_TEMPLATE_COMPILEDIR variables. They had a mixture of forward slashes, backslashes and double backslashes in the paths. Once I changed them all to single forward slashes, I could reach CiviCRM. My example below:
global $civicrm_root; $civicrm_root = 'D:/www/wordpress/public_html/wp-content/plugins/civicrm/civicrm/'; define( 'CIVICRM_TEMPLATE_COMPILEDIR', 'D:/www/wordpress/public_html/wp-content/plugins/files/civicrm/templates_c/' );
Do you have advice on how to establish the civicrm event – info/online registration on a particular page on a wordpress blog. that bit eludes me.
Many thanks.
You can find an example on the CiviCRM 4.1 Demo site on WordPress at http://wordpress.demo.civicrm.org/.
One method is on post ID 11 (http://wordpress.demo.civicrm.org/?p=11). The post content includes a CiviCRM tag
[civicrm component="event" id="1" mode="test" action="info"]
If you are familiar with CiviCRM on Drupal or another platform, there is a similar URL format for an event’s registration page, where you specify the CiviCRM module path and event ID. For example:
http://wordpress.demo.civicrm.org/?page=CiviCRM&q=civicrm/event/info&id=1&reset=1
Be sure you have Online Registration enabled for your event for the page to appear. Thanks for the question, I hope it works on Windows and WordPress just as well.
Awesome tip, just literally saved me from repeatidly banging my head of my desk.
Good one mate.
I just discovered that you don’t need to comment out that entire chunk of code. There is just one minor incompatibility. If you notice, the second line:
this->requireWriteable( CIVICRM_DIRECTORY_SEPARATOR . $dir,
prepends the directory separator to the directory path that the script will check to see if it is writable. Which ends up being something like this to the system: “/C:/inetpub…” The breaks the process as the Windows OS doesn’t understand this path. So all you have to do is just delete the prepended directory separator. The code should look like this:
this->requireWriteable( $dir,
I’m trying to setup CiviCRM on my WordPress site, but I’m not able to get past “Could not obtain a write lock for the table.” Is there a way to change this setting without access to the MySQL database? I host with a small company and haven’t been given MySQL admin access. If I do get access to something like phpMyAdmin, do I just run a SQL command?
It sounds to me czeller, that it may be just because you do not have MySQL “lock table” privileges (such as described in http://forum.civicrm.org/index.php?topic=13208.0). If you contact your hosting company, they may be able to resolve that for you.