Answers.Body: <p>This is a workaround rather than an answer, as I've not figured out how to do what I originally asked. But I've avoided it the need for it for the time being by treating all users who don't have the active member role as expired. That might not work for more complicated membership structures, but I think it meets my needs for now.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-08T16:52:32.363Z
Answers.LastActivityDate: 2019-05-08T16:52:32.363Z
Answers.UserDisplayName: somnolentsurfer
Body: <p>I'm testing CiviMember Roles Sync to build a membership web site. The majority of our users are organisations, all of whose employees and volunteers should have access to the restricted nodes on the site.</p>
  
  <p>I've set up Drupal roles for active members and expired members, and I've created the relevant organisation and individual memberships in CiviCRM. Then I've set up the association rules as illustrated (obviously 'church' is our organisation membership and 'supporter' the individual):</p>
  
  <p><a href="https://i.sstatic.net/TihqW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/TihqW.png" alt="screenshot showing rules setting Drupal role to active member when status is current, new, or grace; and to expired member when status is expired, cancelled or deceased."></a></p>
  
  <p>These rules seem to work just as expected for adding and removing individual members. But contacts who inherit their membership from an organisation never seem to get marked as expired themselves. So if a contact is removed as an employee or volunteer with their parent organisation they are stripped of their active member role without being reassigned the expired member role. Is there a way to sync roles on removal of the right to an inherited membership?</p>
  
  <p><strong>Postscript:</strong> When I stated writing this question, my test user didn't seem to have the active role removed when disabling the relationship to the parent organisation. As I've continued testing, that's started working even though I don't believe I've changed anything. But I still can't assign the expired role at this point, so any assistance gratefully received.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-07T19:46:06.250Z
Comments.Text: Worth noting that Drupal roles don't get modified (usually) until that user logs in, at which point it checks if the users should get any special roles based on eg the CiviMember Roles Sync etc. may explain why it 'suddenly' started working?
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-05-08T09:42:28.533Z
Comments.Text: It's possible I'd turned on 'Synchronize when Drupal cron is ran' and 'Synchronize when membership is updated' after I'd started testing, though I was certain I'd at least run a manual sync before concluding it wasn't working. Anyway, weird, but as long as it works now! Still need to assign the expired role though.
Comments.UserDisplayName: somnolentsurfer
Tags: <drupal><civimember><roles>
Title: Assigning Drupal roles on removal of inherited membership
ThreadText: # Assigning Drupal roles on removal of inherited membership
  
  (Asked by: username_0 on 2019-05-07)
  
  I'm testing CiviMember Roles Sync to build a membership web site. The majority of our users are organisations, all of whose employees and volunteers should have access to the restricted nodes on the site.
  
  I've set up Drupal roles for active members and expired members, and I've created the relevant organisation and individual memberships in CiviCRM. Then I've set up the association rules as illustrated (obviously 'church' is our organisation membership and 'supporter' the individual):
  
  [![screenshot showing rules setting Drupal role to active member when status is current, new, or grace; and to expired member when status is expired, cancelled or deceased.](https://i.sstatic.net/TihqW.png)](https://i.sstatic.net/TihqW.png)
  
  These rules seem to work just as expected for adding and removing individual members. But contacts who inherit their membership from an organisation never seem to get marked as expired themselves. So if a contact is removed as an employee or volunteer with their parent organisation they are stripped of their active member role without being reassigned the expired member role. Is there a way to sync roles on removal of the right to an inherited membership?
  
  **Postscript:** When I stated writing this question, my test user didn't seem to have the active role removed when disabling the relationship to the parent organisation. As I've continued testing, that's started working even though I don't believe I've changed anything. But I still can't assign the expired role at this point, so any assistance gratefully received.
  
  **Tags:** drupal, civimember, roles
  
  > **Comments:**
  > **username_1**: Worth noting that Drupal roles don't get modified (usually) until that user logs in, at which point it checks if the users should get any special roles based on eg the CiviMember Roles Sync etc. may explain why it 'suddenly' started working?  
  > **username_0**: It's possible I'd turned on 'Synchronize when Drupal cron is ran' and 'Synchronize when membership is updated' after I'd started testing, though I was certain I'd at least run a manual sync before concluding it wasn't working. Anyway, weird, but as long as it works now! Still need to assign the expired role though.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-05-08. Score: 1
  
  This is a workaround rather than an answer, as I've not figured out how to do what I originally asked. But I've avoided it the need for it for the time being by treating all users who don't have the active member role as expired. That might not work for more complicated membership structures, but I think it meets my needs for now.
  
  
  ---
  
  