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

Sync Membership with Role AND Capabilities #38

Open jbonlinea opened 3 years ago

jbonlinea commented 3 years ago

Hi there,

I've been thinking more than once wether I should use role or capabilities as the right syncing method, wondering if capabilities wasn't' overkill for my need, whil thinking that it may be nice to be able to programatically displace content according to memberhsip staut.

In the end I wen for capabilities, which do the job great by itself.

However roles are handled by many wp plug-in, while capabilities aren't, I mean distinguis user based on their role and not their capabilities.

Now, I'm facing an other user case where I NEED to use role (at least to simplify my life). I could, but that I'll lose the ability to distinguish user based on their membership statut, which is very sad.

I'm thus wondering... why couldn't get the best of both world ? If one select role as syncing method,

Could this be doable or is it heretic ? is there a use case that could disqualify this approach ?

I feel the need for simplicity with role so "basic" needs are covered simply, and I feel the need for capabilities for fine tuning custmisations, but I can't think of a situation where adding membership statute on top of user role could break something. (of course the pure capability approch may remain as it is as not every use case may want to create new role for each membership type)

What do you think ?

Cheers

side note : anyhow, this plug-in is a huge step forward, and I'll never say it enough, but thank you for this and everything else :)

christianwach commented 3 years ago

You can use this action with a callback that implements the capabilities code to achieve what you want.

jbonlinea commented 3 years ago

Hi

Ok cool thank's

However may I ask why having either capability only or role only, and not either capability only or role+capability ?

I understand that not anyone need/want role, but I don't understand how having capabilities on top of role may be detrimental ? Is it to be savy ? and if yes savy in what server processing resource, database usage ? is that this big to be critical ?

Then why not having capabilities, roles and capabilities+role for who needs. Setting the latest would be exactly like role but the capability would be granted too.

Cheers