Comments (12)
I forgot to mention I'm on WP 4.3.1 and CiviCRM 4.6 and I have the 'Members' plugin installed
from civicrm-wp-profile-sync.
We found the reason... if a user in WP does NOT have a role assigned (not sure how/why this happened - perhaps a glitch somewhere during import maybe?) then the sync plugin ignores it. The expiry role is set to "anonymous user". If I add that to the user who should have active membership and then sync then it all works swimmingly.
Is it possible to have the sync pick up users who aren't currently "anonymous user" and assign the role 'member' where the rule meets the active membership criteria? All I really want it to do is tick or untick the "member" role.
from civicrm-wp-profile-sync.
@oobi Thanks for the report. I'm not sure it's the place of this plugin to audit and fix people's WordPress installs, but I'll think about what warnings it could display.
All I really want it to do is tick or untick the "member" role.
Does the plugin not do this for your users (well, at least for users those who do have a role)?
from civicrm-wp-profile-sync.
It does work when users do have the specified roles, yes. Adding or removing a membership then toggles between the active and inactive role (member/anonymous).
The issue may just be a mismatch in my expectation of what it's intended to do. I had assumed that the sync would apply the appropriate WP group to any user who didn't already have it set so as to keep Civi as the "source of truth" for the correct user state.
It seems to work like this:
is Civi member and is WP anonymous?
unset WP anonymous, set WP member
is NOT Civi member and is WP member?
unset WP member, set WP anonymous
I guess what I had expected was more along the lines of
is Civi member and not WP member?
set WP member, unset WP anonymous
is NOT Civi member and WP member?
unset WP member, set WP anonymous
I haven't yet tried to see what it does if the user has been assigned some other role such as "author" or "editor" instead of "anonymous". WP allows us to set multiple roles, so some members have extra rights on the site.
from civicrm-wp-profile-sync.
I'm not sure I follow your membership conditions. How is "is Civi member and is WP anonymous?" different from "is Civi member and not WP member?" especially since they both have the same outcome of "unset WP anonymous, set WP member" (or vice versa).
This plugin essentially reacts to changes in membership status on the Civi side. So when a membership is applied to a Contact, the appropriate rule is triggered and the WordPress user receives the defined role or capability. It won't "batch affect" multiple users as such except when using "Manual Sync" which is only really intended to be run on first install.
This does in effect 'keep Civi as the "source of truth" for the correct user state' but only for those WordPress users who have a Civi membership, or for those whose membership status changes. It would be overreach for this plugin to affect all WordPress users regardless, since there are any number of ways that a WordPress install can be set up. There are, however, filters and actions in place that would allow you to code things that way if you wanted to.
Disclaimer: I only use role sync on a test site. WordPress works more fluently with capabilities, so that's what I use for production sites.
Edit: I wanted to expand on your comment about roles such as "author" or "editor", which is one of the prime reasons I use capabilities. Imagine you have a WordPress user with "author" role who (for whatever reason) signs up for a Civi membership. Now imagine that membership grants "subscriber" role because it's largely used for public signups on your site. Suddenly your author is demoted to "subscriber" on the site and is locked out of areas that they could previously access. If you use capabilities, on the other hand, then no such problem occurs: WordPress role is completely independent of Civi membership, and therefore having one or more Civi memberships simply grants a user those extra capabilities on the site. You can switch the WordPress user from "contributor" to "editor" and the capabilities granted by membership will be unaffected.
Sure you can use multiple roles as Drupal does, but I find the implementation of this in WordPress to be clumsy at best and IIRC the core WP devs recommend the capabilities approach instead. Having said that, I know that bbPress adds an additional role to users when installed - a situation that this plugin takes those into account when applying its association rules. Have a look at the way this plugin integrates with the Groups plugin if you're interested in a more nuanced approach.
from civicrm-wp-profile-sync.
The distinction between the tests I mentioned is whether presence or absence of the anonymous role has a bearing on whether the Civi member should be assigned the active member role. I haven't dug through the code to verify what's being checked, but from observation it seem to ask "is this user in the inactive member role" before assigning the active member role. I would have thought a more appropriate test would be "is this user NOT in the active role".
This applies to a full manual sync or when changing (adding/removing/editing) membership. It works really well provided the conditions above are met.
I wasn't suggesting that all WP users should be affected - just the ones linked to changes in Civi (the way it works now). It's just the test for "should I activate this guy or not" I was questioning.
from civicrm-wp-profile-sync.
it seem to ask "is this user in the inactive member role" before assigning the active member role. I would have thought a more appropriate test would be "is this user NOT in the active role".
Ah, I see now, thanks. I see that it's a conundrum specific to role sync that doesn't apply to capability sync. The edit to my previous comment explains why I think capability sync is more a more WordPress-friendly approach... but I'll have a think about the issue you've raised.
from civicrm-wp-profile-sync.
thanks for your time :)
from civicrm-wp-profile-sync.
It strikes me that we're discussing this in the issue queue for the wrong plugin - I think this discussion refers to CiviCRM WP Member Sync rather than this one :-)
from civicrm-wp-profile-sync.
you're dead right - my bad!
from civicrm-wp-profile-sync.
@oobi I'd like to close this, but wanted to check with you that the Member Sync plugin works at it should...
from observation it seem to ask "is this user in the inactive member role" before assigning the active member role
I don't think this observation is correct. Since the initial commit, the plugin's logic has always been to check only if the primary role differs from the role indicated by the sync rule. See this line and this line for details. I can't see how even not having a role at all would alter the decision to switch the user's role to satisfy the sync rule.
from civicrm-wp-profile-sync.
@oobi Please can you open a new issue on the CiviCRM WP Member Sync repo if the 0.3 update doesn't perform the sync as you expect it to? I've reworked the sync routines for the latest release.
Cheers, Christian
from civicrm-wp-profile-sync.
Related Issues (20)
- File upload for custom contact field? HOT 1
- Bi-directional-Sync works but if wp-post created first, no civi-contact are created HOT 7
- Sync custom post type with events HOT 3
- May a CPT without title field be used to sync CiviContact HOT 4
- "Undefined index: contact_type_a" in log while relationships seems well defined HOT 8
- how to use wp action like "save_post" along cwps : any recomendations ? HOT 4
- PHP 8 Deprecation Notices HOT 3
- Primary Email update HOT 39
- Contact action : Not enough data to save a Contact HOT 18
- ACFE Form action: remove from group HOT 2
- Contact deletion: sync do not occur when Users are bulk deleted in WordPress
- Editing a Participant in CiviCRM clears some Participant Fields in ACF unless it is saved twice in CiviCRM HOT 2
- File field: mapping ok, but nothing happens when using ACFE forms
- CiviCRM Participant not create when WP-Participant is created programmatically HOT 2
- Sync a WordPress taxonomy to an ACF custom field of type radio or checkbox HOT 1
- Add option to disable nickname syncing HOT 1
- profile sync filling ConfigAndLog with Authentication Failures on CiviCRM 5.57+ HOT 9
- Request to add support for syncing of built-in WordPress User Profile Picture with CiviCRM Contact Image Field HOT 1
- Contact type on user creation
- Multiple issues with the Image field in ACFE form
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from civicrm-wp-profile-sync.