christianwach/civicrm-wp-member-sync

Can Member Sync with Wordpress multisites be improved, specifically CiviCRM groups to wordpress subsites.?

normancates opened this issue · 2 comments

I'm setting up a Wordpress sub-domain multisite with CiviCRM. Site 1 is the main site, Site 2 is a subsite.

I've followed the instructions as best I can
https://docs.civicrm.org/installation/en/latest/multisite/wordpress/

And I think I have it more or less working with groups in CiviCRM.

The goal I'm going for is the ability for people to subscribe to individual sites in Wordpress. Some subsites will be clubs. Some will be conventions.

In order to keep separation of people in CiviCRM, I followed the instructions to create one group for each subsite.

And used the Admin Utilities plugin to set the CiviCRM group and parent organisation.

Then I did a CiviCRM synchronise, and most of the Wordpress subscribers seemed to get the correct Group assigned. I say most because there are one or two, including my super admin account, that got no groups. BUt that isn't the point now.

In my testing, I created a Wordpress member on site 2. They have a role there. But they were not a member of site 1.

I worked out some code that let an existing user click on a button / menu item, and subscribe to a site they were not yet a member of. I used the function

add_user_to_blog(#siteID, $userID, $role );

And it successfully subscribed them to Site 1.

However, I noticed that CiviCRM has not added them to the group linked to that particular site.

I see a few options here:

  • the add_user_to_blog function doesn't trigger a CiviCRM action
  • Member Sync does not recognise the user as "new" because they already exist in CiviCRM. So it doesn't do anything.
  • Member Sync isn't checking for CiviCRM Group memberships of users and that they are in all the groups relevant to their subscriptions of various subsites.

THere are various reasons to keep these sub-sites from being able to see all the user data. Mainly privacy laws.

I would note that in an ideal world, running a manual synchronise would do all these checks too. ie They people are in the correct CiviCRM groups, based on the site they are subscribed to.

Thanks for any improvements you can make here :-)

Oh, I should ask. What is a domain in the context of CiviCRM? Its talked about obliquely, and its hard to know if this is something internal to CiviCRM. Or if its a reference to the subdomain of the sub-site on a multisite.

Is the domain just the subsite, therefore the domain ID is the sub-site ID?

The documentation is silent on the subject. And the setup page skates over it.

CHeers

Thanks for any improvements you can make here

@normancates Having the code you want added to this plugin would require development time - do you have the resources to enable that to happen? Happy to help if that's the case. Alternatively - if you want a DIY approach - I'm pretty sure you can make use of the numerous actions and filters in this plugin to achieve your aims.

FWIW, multi-domain CiviCRM is a complicated business and yes, it's poorly documented... perhaps you can help to improve the docs with the hindsight of your investigations? I find the nomenclature particularly confusing - sometimes it's called CiviCRM multisite, sometimes multi-domain. Personally I don't use it because CiviEvents aren't domain-aware so I find other ways to achieve what I want.

Cheers, Christian