0

I'm working on an inherited CiviCRM/WordPress site using the CiviCRM WordPress Member Sync https://wordpress.org/plugins/civicrm-wp-member-sync/ and the Members plugin https://wordpress.org/plugins/members/ and I can't find an answer to the question below in any docs.

In the past, someone used the Manual Synchronize feature of Member Sync to manually sync all CiviCRM members to WordPress, but all users were Administrators. After a reinstall of CiviCRM, an import of a CiviCRM database, and deleting all the old WordPress Administrators, I now need to manually sync the users again. But of course I don't want them synced as administrators; I need them synced as lower level roles in order to restrict access to page content and of course not give admin privledges.

How do I control the user role that the CiviCRM users are synced as WordPress users? I'm using the "Role" Synchronization Method.

Is this controlled by Association Rules? I need to add a rule for each CiviCRM membership level?

Will the "New User Default Role" in WordPress>General Settings override synced users Association Rules?

Do I need to use https://wordpress.org/plugins/groups/ ?

3
  • I don't know WP as well as Drupal, but if you did this in Drupal the outcome would be that someone would only become an Authenticated user. I assume WP has a similar concept, ie they get the default user role
    – petednz - fuzion
    Dec 2, 2019 at 18:30
  • Ah, that might be it; I now see "New User Default Role" set as Administrator in WordPress>General Settings. I didn't remember that setting; and now realize that maybe it has an overall effect on all imported users. Dec 2, 2019 at 18:34
  • glad it helped. i have converted above discussion to an Answer to help others (which is what Stack Exchanges wants). Could you pls Accept and +1 it.
    – petednz - fuzion
    Dec 2, 2019 at 19:03

2 Answers 2

2

How do I control the user role that the CiviCRM users are synced as WordPress users? I'm using the "Role" Synchronization Method. Is this controlled by Association Rules?

Yes, exactly. Association Rules are the "glue" between CiviCRM Memberships and WordPress Roles (or Capabilities).

I need to add a rule for each CiviCRM membership level?

Yes. FYI, if you have a large number of Membership Types, have a look at the newest feature in CiviCRM WordPress Member Sync, which allows you to do "bulk creation" of Association Rules.

Will the "New User Default Role" in WordPress>General Settings override synced users Association Rules?

No. It comes into play when syncing to Capabilities, since WordPress users must have a role of some kind. When syncing to Roles, the selected role is granted instead.

Do I need to use https://wordpress.org/plugins/groups/ ?

No, but CiviCRM WordPress Member Sync has deeper integration with the Groups plugin than with the Members plugin.

The integration with Members consists solely of granting WordPress users the restrict_content capability, which is what Members uses to determine access to, well, restricted content. The capability is removed when the Membership expires.

The integration with Groups is more sophisticated, in that Group membership can be independent of the user's role or capability. Capabilities can be assigned to groups in much the same way that roles are collections of capabilities. Membership Types can be added to (or removed from) groups depending on the status of the membership.

So... if you have removed the WordPress admin users and want to recreate them with a different role, make sure you have edited your Association Rules so that the Contacts with the appropriate Membership Type sync to your desired current and expiry roles.

FWIW, by default CiviCRM WordPress Member Sync will not sync users with the admin role in WordPress. This can be modified with a filter, but since you're avoiding granting WordPress users admin rights, you shouldn't be caught by this.

2
  • Thanks! This is really helpful. One extra question: In Add Association Rules, after I select a CiviMember Membership Type, the Current Status is a little confusing; I'm thinking I tick both New and Current if I want to gate content for all members in that membership type? What are the differences between New and Current? Dec 4, 2019 at 18:07
  • It's best to declare New, Current and Grace as "current" memberships. (FWIW, there's discussion about referring to these as "active" memberships in future.) New memberships become Current memberships after a period chosen in the "Membership Status Rules" that you define - if you loaded the demo data, this happens after 3 months. Dec 5, 2019 at 8:57
1

When you use the synchronise the outcome should be that someone would only become an Authenticated user ie the default user role so perhaps check under "New User Default Role" and ensure it is not set as Administrator in WordPress>General Settings.

2
  • That's mostly true; but what happens if I have different roles set up in Members and different Association Rules for those roles? Dec 2, 2019 at 20:05
  • I think WP also offers a synch for the Roles to be based off either civi Groups or civi memberships. not sure if either of those help you. certainly available in drupal.
    – petednz - fuzion
    Dec 2, 2019 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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