2

Ok, so I gave up on having it in two different locations since I couldn't seem to get a clear answer from anyone regarding it being able to be done. So I've moved everything over and set it up as a Drupal multi-site. Now I am working to connect CiviCRM to the second site. It's already been on the main site for years.

However, the instructions on how to do the CiviCRM multi-site seem to be missing some steps or making some assumptions. As such, I'm stuck. I'm using the instructions here: https://docs.civicrm.org/sysadmin/en/latest/install/multi-site/

The page says:

Create the domain record¶
Insert a new domain record into the CiviCRM database. For example if your new contact is 555

INSERT INTO `civicrm_domain` (
  `name`,
  `description`,
  `version`,
  contact_id)
SELECT 
  'site 2',
  'second test site',
  cd.version,
  555
FROM civicrm_domain cd
WHERE cd.id = 1;

"For example if your new contact is 555" - what new contact? I can add the line, but have no idea what the "contact_id" field should contain.

As such, I'm stuck at this step.


OLD QUESTION:

I know you can have multiple sites using the same CiviCRM install. Usually they are set up using a Drupal multi-site. But can you do it if the two sites are installed in two different locations on the same server? So not a multi-site setup?

I'd love to keep the two sites separate, as then the backups of them are smaller, easier to restore when necessary, etc. Not to mention that I don't bother the live site trying to merge the two (one is a renovation on an older site). If I have to have them in the same directory, I can do that, but would rather not. So I thought I would check.

I want the two sites to be able to have a user be attached to their membership record, for instance, because that controls their access to various items. Or be able to see the trainings they've gone to. Be able to update their record.

So I need to know:

  1. Can I have two sites in different directories that use the same CiviCRM install and database so that the data is shared? So that the same user can see their same information in Civi regardless of which site they are on?

  2. If not, if they are set up as a Drupal multi-site in the same directory, would it work? Would they share the same CiviCRM install and database so that the data is shared? So that the same user can see their same information in Civi regardless of which site they are on?

I need to know pretty quickly, because I'm to the merging stage of these two sites and I need to know if I am going to have to completely redo the strategy and do the fake multi-site thing in Drupal where they look to be separate sites, but aren't. I'd rather not do that, though, as it will make our SQL database huge since it's an informational site with tens of thousands of records.

6
  • When you refer to "the fake multi-site thing" are you referring to the Domain Access module? Commented Oct 29, 2018 at 4:35
  • Yes, I think that is the module that I was thinking of. I'd rather not do it since it would make our database absolutely enormous. Not to mention having to do a lot of new configuration on the main site, plus rebuild everything from the dev second site onto the live site. I'd really like to keep these two in separate Drupal databases. Commented Oct 29, 2018 at 5:42
  • Jenni - i would love to better understand what you are finding is preventing you from setting up two drupal codebases with a single civicrm. The 'domain' value in the uf_match ensures that the drupal users are correctly associated with the right civicrm record.
    – petednz - fuzion
    Commented Oct 29, 2018 at 21:52
  • The question is about doing it from two different hosting accounts: So one is at /home/user1/public_html/ and the other is at /home/user2/public_html/ Commented Oct 30, 2018 at 2:37
  • I'd prefer to do it in two different hosting accounts so that I'm not needing to be in messing with the live site other than some minor changes to connect the two sites to CiviCRM. If I need to do it in one hosting account, I will, but would prefer to do it in two. If I do it in one, then it will work for the two different Drupal installs that are utilizing Bakery (shares the users across the 2 sites) to connect those users to the correct CiviCRM record, correct? Commented Oct 30, 2018 at 2:38

3 Answers 3

1

can you do it if the two sites are installed in two different locations on the same server? So not a multi-site setup?

Yes multisite can work with different drupal codebase/databases

9
  • So if they are at: /home/user1/public_html and /home/user2/public_html I can still share the same CiviCRM (users and all) between the two of them? Commented Oct 24, 2018 at 19:41
  • yes but i forget if it still requires special settings to ensure the users from Domain 1 and Domain 2 are correctly handled in uf_match table
    – petednz - fuzion
    Commented Oct 25, 2018 at 2:54
  • Ok. Hopefully someone can point me to how to do it. Everything I have found thus far is for a Drupal multi-site setup. Commented Oct 25, 2018 at 3:12
  • can you update your Q with the documentation you have followed/read?
    – petednz - fuzion
    Commented Oct 25, 2018 at 5:51
  • I haven't followed any yet, as they are all for a Drupal multi-site. Not sure what good it would do to post links to pages that are on a completely different solution? Commented Oct 25, 2018 at 11:31
0

To answer the followup question - two separate CMSes on the same server can share the same CiviCRM EXCEPT for the users. Since users are controlled by the CMS, the users are tied to the CMS.

If you want to share users, you'll need to use a solution that shares users at the CMS level, like OAuth, LDAP, SAML or Bakery. Or you could just make the same users on both servers. The only catch is that each user will have two CiviCRM records, one per account.

8
  • Yes, the user log-ins would be through Bakery. I mean their details that are stored inside CiviCRM as opposed to Drupal. I need them to be able to access their membership information, event purchase information, etc. Commented Oct 25, 2018 at 11:30
  • Hmm - I'm not 100% sure you can do this tbh. Reason being, the CiviCRM contact is tied to the user, which is site-aware. So John Doe will have two Civi records - one connected to site A, one connected to site B. It's not possible to connect a single Civi contact to two separate users. Commented Oct 25, 2018 at 17:44
  • It's not two separate users - you use a module like Bakery, which shares the same users between two accounts. This is already done all the time with a Drupal multi-site where they're sharing the same Drupal codebase inside the same account on the server. Commented Oct 26, 2018 at 16:42
  • You're free to try it and see if it works - please let us know if it does! However, my understanding is that Bakery syncs records between the users table on multiple Drupal sites. While functionally that appears as "one user account", each database maintains its own users record - which is what CiviCRM relies on. Hopefully I'm wrong though! Commented Oct 26, 2018 at 19:07
  • Well, it must work since there are official pages on how to have a Drupal multi-site run on one CiviCRM database. Commented Oct 26, 2018 at 21:16
0

Answering your new question. You say:

"For example if your new contact is 555" - what new contact? I can add the line, but have no idea what the "contact_id" field should contain.

In the documentation, in the line above that query it says

Create a new contact to be the domain contact for the new domain

In other words, every 'domain' needs to have an Organisational contact record that it is associated with.

Does that help?

3
  • Yes, that was the missing piece - that the "new contact" means create an organizational record. Of course the only issue is that both sites are the same organization. So would I just link it to the same organization, or does it have to be unique? Commented Nov 1, 2018 at 2:33
  • pretty sure it has to be unique as it is what 'relates' to the domain
    – petednz - fuzion
    Commented Nov 1, 2018 at 3:50
  • Hmmm... Hope that doesn't cause any issues, then, since they're both the same organization. I guess I will just create another one that just has almost the exact same name and use that. Right now it just has the contact id for the same one. Commented Nov 1, 2018 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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