christianwach / civicrm-wp-member-sync

CiviCRM WordPress Member Sync plugin keeps a WordPress user in sync with a CiviCRM membership by granting either a role or capabilities to a WordPress user who has that membership.
https://wordpress.org/plugins/civicrm-wp-member-sync/
GNU General Public License v2.0
17 stars 10 forks source link

Users are not assigned specific role #34

Closed shaneonabike closed 3 years ago

shaneonabike commented 3 years ago

Hey there! Thanks so much for building an amazing plugin.

I seem to be running into a strange issue. I had imported members into the users table, as well as CiviCRM so I have identical records.

So we have member@example.com in CiviCRM as Home (Primary), and in Wordpress there is a corresponding user.

After that I manually added the membership record for each member since we are transition from an old system. When I ran the manual synchronization none of the users roles are changed. Does it make a difference that I am using custom roles using the Members plugin. I don't think it should b/c I haven't had any hiccups like this before. My config is:

Example Association:

What am I missing? Is this a bug potentially? What more debug info can I provide.

christianwach commented 3 years ago

@shaneonabike Did you also add the UFMatch entries? That's CiviCRM's (and this plugin's) way of knowing which Contact maps to which User.

shaneonabike commented 3 years ago

Actually, I think I have two problems... the first being I was attempting to have Organizations match to a user in the system, but I think in general this isn't allowed by CiviCRM. I dealt with that issue and can confirm there are individual records like the following:

I also unchecked the synced contact types so that it would do the organizations properly. What am I missing here?

shaneonabike commented 3 years ago

... And further testing shows me that if the Individual has a Membership then it works just fine so I think this has to do with the fact that it is the Organization who has the membership... Is there a way to provide further options so that we can test again the Employer having a membership and then giving the same access? I thought that was the nature of the "Synced Contact Types" checkbox.

christianwach commented 3 years ago

I was attempting to have Organizations match to a user in the system, but I think in general this isn't allowed by CiviCRM.

@shaneonabike CiviCRM certainly assumes that WordPress Users are Individuals and treats them as such in its calls to synchronizeUFMatch. My advice would be that it's be better not to sync Orgs to WordPress.

this has to do with the fact that it is the Organization who has the membership

Org Memberships should be inherited by Individuals. Are you finding that's not the case? You can replicate the "grouping" that is an Org in WordPress in other ways.

shaneonabike commented 3 years ago

Yeah I finally realized that this would not be possible without hacking things together. So I modified the process a bit and will record it here for others to see

Thanks so much for all the time that you have provided to give me solid answers I appreciate that!

christianwach commented 3 years ago

@shaneonabike Glad you're sorted and thanks for leaving a cookie trail for others.