Description
CiviCRM Member Sync 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.
This enables you to have, among other things, members-only content on your website that is only accessible to current members as defined by the Membership Types and status rules that you set up in this plugin’s settings. CiviCRM Member Sync is compatible with both the Members and Groups plugins for managing members-only content in WordPress. See the Installation section for details.
Requirements
This plugin requires a minimum of WordPress 4.9 and CiviCRM 5.19. It is compatible with the Members and Groups plugins. Please refer to the Installation page for configuration instructions.
It is also strongly recommended that you also install CiviCRM Admin Utilities and have version 0.6.8 or greater activated. Make sure the checkbox labelled âCheck this to fix the Contact âsoft deleteâ processâ is checked so that Contacts that have been âsoft deletedâ have their corresponding WordPress User’s status updated.
Plugin Development
This plugin is in active development. For feature requests and bug reports (or if you’re a plugin author and want to contribute) please visit the plugin’s GitHub repository.
Shouts Out To…
This plugin builds on the work done by Tadpole Collective and originally developed by Jag Kandasamy. Kudos.
Installation
- Extract the plugin archive
- Upload plugin files to your
/wp-content/plugins/
directory - Make sure CiviCRM is activated and properly configured
- Activate the plugin through the âPluginsâ menu in WordPress
The first thing to decide is whether you want CiviCRM Member Sync to synchronize CiviCRM Memberships to WordPress Roles or WordPress Capabilities. If, for example, you need your WordPress User Roles to be independent of Membership Status, then choose Capabilities. The default synchronisation method is Capabilities, because WordPress has limited support for multiple Roles.
Working with Capabilities
- Visit the plugin’s admin page at âCiviCRMâ –> âMember Syncâ.
- Select âCapabilitiesâ as the sync method
- Click on âAdd Association Ruleâ to create a rule. You will need to create a rule for every CiviCRM Membership Type you would like to synchronize. For every Membership Type, you will need to determine the CiviMember states that define the member as âcurrentâ thereby granting them the appropriate WordPress Capabilities. It is most common to define âNewâ, âCurrentâ and âGraceâ as current. Similarly, select which states represent the âexpiredâ status thereby removing the WordPress Capabilities from the User. It is most common to define âExpiredâ, âPendingâ, âCancelledâ and âDeceasedâ as the expired status.
- âCurrent Statusâ adds a âMembership Capabilityâ to the WordPress User, while âExpired Statusâ removes the âMembership Capabilityâ from the WordPress User. This Capability will be of the form âcivimember_IDâ, where âIDâ is the numeric ID of the Membership Type. So, for Membership Type 2, the Capability will be âcivimember_2â.
- Note: If you have the Groups plugin active, then all âcivimember_IDâ Capabilities will be added to its custom Capabilities as well as to the list of Capabilities used to enforce read access on Posts. If you have Groups 2.8.0 or greater installed, then you will have the option to specify one or more âcurrentâ and âexpiredâ Groups to which Users will be synced depending on whether their Membership is âcurrentâ or âexpiredâ.
- Note: If you have the Members plugin active, then the ârestrict_contentâ Capability will also be added.
- Note: If you have BuddyPress active, then you will have the option to specify one or more âcurrentâ and âexpiredâ Groups to which Users will be synced depending on whether their Membership is âcurrentâ or âexpiredâ.
- An additional âMembership Status Capabilityâ will also be added to the WordPress User that is tied to the status of their Membership. This Capability will be of the form âcivimember_ID_NUMâ, where âIDâ is the numeric ID of the Membership Type and âNUMâ is the numeric ID of the âMembership Statusâ. So, for Membership Type 2 with Membership Status 4, the Capability will be âcivimember_2_4â.
Working with Roles
- Visit the plugin’s admin page at âCiviCRMâ –> âMember Syncâ.
- Select âRolesâ as the sync method
- Click on âAdd Association Ruleâ to create a rule. You will need to create a rule for every CiviCRM Membership Type you would like to synchronize. For every Membership Type, you will need to determine the CiviMember states that define the member as âcurrentâ thereby granting them the appropriate WordPress Role. It is most common to define âNewâ, âCurrentâ and âGraceâ as current. Similarly, select which states represent the âexpiredâ status thereby removing the WordPress Role from the User. It is most common to define âExpiredâ, âPendingâ, âCancelledâ and âDeceasedâ as the expired status. With ârolesâ as your synchronization method, also set the Role to be assigned if the Membership has expired in âExpiry Roleâ. This is not needed when working with Capabilities.
- It may sometimes be necessary to manually synchronize Users. Click on the âManual Synchronizeâ tab on the admin page to do so. You will want to use this when you initially configure this plugin to synchronize your existing Users.
- Note: If you have the Groups plugin activated and it is version 2.8.0 or greater, then you will have the option to specify one or more âcurrentâ and âexpiredâ Groups to which Users will be synced depending on whether their Membership is âcurrentâ or âexpiredâ.
* Note: If you have BuddyPress active, then you will have the option to specify one or more âcurrentâ and âexpiredâ Groups to which Users will be synced depending on whether their Membership is âcurrentâ or âexpiredâ.
Manual Synchronize
It may sometimes be necessary to manually synchronize Users. Click on the âManual Synchronizeâ tab on the admin page to do so. You will want to use this when you initially configure this plugin to synchronize your existing Users.
Test Test Test
Note: Be sure to test this plugin thoroughly before using it in a production environment. At minimum, you should log in as a test User to ensure you have been granted the appropriate Role or Capabilities when that User is given Membership. Then take away the Membership for the User in their CiviCRM record, log back in as the test User, and make sure you no longer have that Role or those Capabilities.
Known Issues
Code that used the civi_wp_member_sync_after_insert_user
hook to send User Notifications on User Account creation should switch to the newer civi_wp_member_sync_post_insert_user
hook to avoid the inadvertent loss of session data.
Reviews
Contributors & Developers
“CiviCRM Member Sync” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “CiviCRM Member Sync” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
0.6.3
- Deletes BuddyPress and âGroupsâ group memberships when a CiviCRM Membership is deleted
0.6.2
- Maintenance release
0.6.1
- Provides a default Domain ID when none is passed
- Makes sure the CAU URL is rendered when needed
0.6.0
- Fixes missing hidden inputs
0.5.5
- Apply username filter when performing dry run
- Misc codestyle improvements
0.5.4
- Fix loading of âAdd Ruleâ screens
0.5.3
- Fix Membership status on CAU listing screen
- Set default for WordPress pseudo-cron to âoffâ
0.5.2
- Introduce actions during ârule_undoâ process
0.5.1
- Introduce âFrom – Toâ functionality for Manual Sync
- Introduce âcivi_wp_member_sync_membership_deletedâ action
0.5
- Introduce âDry Runâ functionality
- Compatibility with CiviCRM Admin Utilities âManage Usersâ screen
0.4.7
- Support for syncing to BuddyPress Groups
- Fix sync for CiviCRM Memberships that do not require payment.
0.4.6
- Housekeeping release
0.4.5
- Fix validation on âRule Addâ screen
0.4.4
- Allow selection of multiple Membership Types when adding an Association Rule
- Introduce âcivi_wp_member_sync_post_insert_userâ action
0.4.3
- Introduce âcivi_wp_member_sync_contact_retrievedâ filter
- Fix references to CiviCRM WP Profile Sync methods
0.4.2
- Introduce âbulk create association rulesâ functionality
- Ask for confirmation before deleting an Association Rule
0.4.1
- Fix sync for Contacts in Trash – fix requires CiviCRM Admin Utilities 0.6.8+
0.4
- Support access control based on âGroupsâ plugin Group Membership
0.3.8
- Fix fatal error when renewing and changing Membership Type
0.3.7
- Allow Manual Sync batch count to be filtered
- Ensure usernames are unique during WordPress User creation
0.3.6
- Allow sync to be restricted to CiviCRM Contacts of Contact Type âIndividualâ
0.3.5
- Fix creation of WordPress User on new Membership
0.3.4
- Make order of processed Memberships explicit
- Support renewals dureing which the Membership Type changes
0.3.3
- Pass CiviCRM Contact ID to âcivi_wp_member_sync_auto_create_wp_userâ filter
- Allow limitless API queries where needed
0.3.2
- Add filter for username prior to creation of WordPress User
0.3.1
- Fix bug in PHP 7
0.3
- Support multiple Memberships per Contact
- AJAX-driven Manual Sync admin page
- Fix sync when Membership is renewed
0.2.7
- Disambiguate network-activated and site-activated installs
- Fix courtesy links to settings pages
0.2.6
- Fixes scheduled sync
0.2.5
- Updates compatibility with Civi plugin
0.2.4
- Adds actions and filters at critical points
0.2.3
- Adds compatibility with Groups plugin
- Better uninstallation cleanup
0.2.2
Fixes sync all reference Props EventConsulting.
0.2.1
Fixes current WordPress Role selector. Props EventConsulting.
0.2
First public release
0.1
Initial release