We are using CiviCRM with Wordpress and would like to switch it to Drupal. I have created a fresh Drupal/CiviCRM install and gave CiviCRM it's own database. How do I go about transferring the data from the old Wordpress site to the new Drupal site?
1 Answer
Assuming that a) you gave CiviCRM a separate database under Wordpress, and b) you installed the same version of CiviCRM under Drupal:
- Dump the current CiviCRM database to a .sql file.
- Load that database into Drupal.
- Review "Moving an Existing Installation to a New Server or Location" for relevant details regarding deleting caches etc.
- Delete all the entries out of the
civicrm_uf_match
table in the CiviCRM database (while logged in as user 1). - Go to Administer menu > Users and Permissions > Synchronize Users to Contacts.
That should repopulate your civicrm_uf_match
table and thus connect your Drupal users to contacts. Log out and log in again (in a different browser) to make sure everything looks good - and clear your caches again!
Don't forget to move the contents of wp-content/uploads/civicrm
to sites/default/files/civicrm
. Don't move templates_c
, but definitely move ang
(if it exists), persist
and custom
.
Things to check
- If you use Mosaico, your templates will reference image locations that don't exist anymore. You'll want to run something like this:
cv api MosaicoTemplate.replaceurls to_url="https://yoursite.org/sites/all/civicrm-custom/extensions/uk.co.vedaconsulting.mosaico/packages/mosaico/templates" from_url="https://yoursite.org/wp-content/civicrm-custom/extensions/uk.co.vedaconsulting.mosaico/packages/mosaico/templates"
- If you want to copy mailings that were sent before the switchover, you need to do something similar on
civicrm_mailing
. Here's an example of one I did:
UPDATE civicrm_mailing SET template_options = REPLACE(template_options, 'https:\\/\\/mysite.org\\/sites\\/wiscience.wisc.edu\\/files\\/civicrm', 'https:\\/\\/mysite.org\\/wp-content\\/uploads\\/civicrm');
UPDATE civicrm_mailing SET template_options = REPLACE(template_options, 'https:\\/\\/mysite.org\\/sites\\/all\\/civicrm-custom\\/extensions', 'https:\\/\\/mysite.org\\/wp-content\\/civicrm-custom\\/extensions');
UPDATE civicrm_mailing SET body_html = REPLACE(body_html, 'https%3A%2F%2Fmysite.org%2Fsites%2Fwiscience.wisc.edu%2Ffiles%2Fcivicrm', 'https%3A%2F%2Fmysite.org%2Fwp-content%2Fuploads%2Fcivicrm');
- If you use a payment processor with a "Silent Post URL" or "IPN", make sure you've changed over to the new style of IPN endpoint before migrating - that is,
https://yoursite.org/civicrm/payment/ipn/XX
(XX
being the payment processor ID) and not one that ends inextern/ipn.php
. Otherwise your IPNs aren't cross-CMS compatible.
-
1Hi. Thanks for the answer. Yes Wordpress has it's own Civi database and it's the same version as Drupal. Unfortunately, when I try to import the Wordpress database into Drupal, I get this error: [ERROR in query 7] Access denied; you need (at least one of) the SUPER privilege(s) for this operation. What does that mean? Commented Apr 16, 2015 at 17:01
-
Also, when you say "Dump" do you mean export via phpMyAdmin (or Sequel Pro)? Commented Apr 16, 2015 at 17:19
-
Yeah, export via the tool of your choice - phpMyAdmin works! As for the error - that really deserves its own question, so I posted the question (and answer) here: civicrm.stackexchange.com/questions/619/… Commented Apr 16, 2015 at 18:38