Body: <p>We have a database of churches who are members of our organisation. People who are volunteers or employees of those churches also inherit membership by relationship. We are using a custom relationship type of 'Minister' to identify which individual related to each church is the lead vicar/minster/pastor/etc.</p>
  
  <p><a href="https://i.sstatic.net/gcCSR.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gcCSR.png" alt="Membership type table, showing how employees, volunteers and ministers should inherit membership."></a></p>
  
  <p>Some ministers are related to more than one church, and I am finding that the minister relationships are also causing memberships to inherit in the wrong direction. i.e. if a minister is with one member church, the membership will pass from the church to the minster, from the minister to any other churches they are with, and then on from those to every volunteer and employee of those churches as well.</p>
  
  <p><a href="https://i.sstatic.net/ZT4bd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZT4bd.png" alt="Relationship type table showing the custom &#39;Minister&#39; relationship type."></a></p>
  
  <p>The membership type table definitely only has the A to B (organisation to individual) relationship included. Why is the membership also passing the other way from individual to organisation?</p>
  
  <p><strong>Edit: Full walkthrough</strong></p>
  
  <p>I have two churches: St. Tests, and St. Joseph the Tester. Both share the same minster, Testy McTestface, but St. Josephs also has a couple of other volunteers. Neither church, nor any of their related contacts, have any memberships.</p>
  
  <p><a href="https://i.sstatic.net/opuB9.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/opuB9.png" alt="Relationship table for St. Tests, showing one relationship to the minister."></a>
  <a href="https://i.sstatic.net/4kYCh.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/4kYCh.png" alt="Relationship table for St. Josephs, showing the minster and two additional volunteers"></a></p>
  
  <p>I add a Church membership to St. Tests:</p>
  
  <p><a href="https://i.sstatic.net/1Avy1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/1Avy1.png" alt="Membership table for St. Tests showing new membership, and that one related membership has been created."></a></p>
  
  <p>A related membership is created for the minister contact, as expected:</p>
  
  <p><a href="https://i.sstatic.net/0ZKll.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0ZKll.png" alt="Viewing the primary membership for Testy McTestface, showing they have inherited their membership from St. Tests Church."></a></p>
  
  <p>But so is a membership for St. Josephs, the other church, through it's relationship to the minister of St. Tests.</p>
  
  <p><a href="https://i.sstatic.net/hgrek.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hgrek.png" alt="Viewing the primary membership for St. Josephs, showing a further membership inherited from St. Tests via the minister."></a></p>
  
  <p>And so are memberships for each of the additional volunteers associated with the second church:</p>
  
  <p><a href="https://i.sstatic.net/JYB0D.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/JYB0D.png" alt="Viewing the primary membership for a volunteer with St. Josephs, showing a further membership inherited from St. Tests via the minister."></a>
  <a href="https://i.sstatic.net/z18nt.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/z18nt.png" alt="Viewing the primary membership for a second volunteer with St. Josephs, showing yet another membership inherited from St. Tests via the minister"></a></p>
  
  <p><strong>Edit: Further screenshots in response to questions</strong></p>
  
  <p>Second degree relationship permissions are turned off.</p>
  
  <p><a href="https://i.sstatic.net/fpViu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/fpViu.png" alt="Second degree relationship permissions are turned off"></a></p>
  
  <p>These are all the CiviCRM extensions I have installed. I tried deleting the membership on the St. Tests example above (which, to confirm, also cleared all the others shown in the screenshots), disabling all these extensions, and then recreating the membership. The problem still occurred.</p>
  
  <p><a href="https://i.sstatic.net/S24LB.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/S24LB.png" alt="Installed extensions: FlexMailer, Shoreditch, GDPR, Mosaico."></a></p>
  
  <p>These are the only Drupal rules I have. I'm using CiviMember Roles Sync to add an 'active member' role to current members, and display a warning to anyone who's had their membership deactivated.</p>
  
  <p><a href="https://i.sstatic.net/RzUiA.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RzUiA.png" alt="Active Drupal rules table"></a>
  <a href="https://i.sstatic.net/P9TBv.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/P9TBv.png" alt="Rule creating Drupal accounts for new members"></a>
  <a href="https://i.sstatic.net/GPw2q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/GPw2q.png" alt="Rule displaying warning to cancelled/expired members"></a></p>
  
  <p><strong>Edit: Some further testing</strong></p>
  
  <p>I tried changing the relationship type between the minister and the two churches from my custom Minister type to the built in Employer/Employee type, and the dodgy memberships persisted. In fact, the minister contact gained a second membership, one inherited from each of the churches he's employed by - even though only one has a membership of its own, and the second is inherited through the minster himself!</p>
  
  <p>When I then went ahead and deleted the original membership all the memberships across all five contacts disappeared. Recreating it, on either church, behaves as expected. Now I'm using the built in Employee relationship type, memberships stay within their own organisation. So it looks like it is something to do with the relationship type, but I've no idea what! Can anyone replicate?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-10T02:41:39.637Z
Comments.Text: That sounds really wrong ie what you are describing should not happen and have never seen this type of problem occur. It may be worth tracking through one example and confirm exactly what you can deduce from the 'related membership' info in the Membership tabs. (but you may have done that)
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-13T13:54:35.123Z
Comments.Text: Thanks. I've added a walkthrough of an example minister and their two churches. I guess it must be something to do with my relationship type, but I don't know what!
Comments.UserDisplayName: somnolentsurfer
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-13T16:44:51.503Z
Comments.Text: Do you have second-degree permissions enabled?  (see https://www.screencast.com/t/VMWoNSkC7k )  That enables a second level of membership rolldown to occur.
Comments.UserDisplayName: Lesley Carter - BackOffice
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-13T20:05:12.263Z
Comments.Text: screenshots of your membership types confirm what you are saying about your 'inherited memberships' and also shots of your Relationship Types
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-13T20:06:00.357Z
Comments.Text: oh also confirm you don't have anything like CiviRules or Drupal (?) Rules kicking in and messing things up, or an Extension.
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-15T11:03:43.543Z
Comments.Text: Thanks, further screenshots added to address those questions. I can't see any reason the rules I have would cause this issue! Petednz, sorry, not quite sure if you're saying my membership and relationship type screenshots are sufficient to confirm the issue, or you're asking for something I've not given?
Comments.UserDisplayName: somnolentsurfer
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-08-17T00:09:32.023Z
Comments.Text: only if your Rel. Type was somehow bi-directional eg you have the same label at both ends but still that shouldn't trigger something like this
Comments.UserDisplayName: petednz - fuzion
Tags: <civimember><relationships>
Title: Membership 'contagion' spreading through relationships
ThreadText: # Membership 'contagion' spreading through relationships
  
  (Asked by: username_0 on 2019-08-09)
  
  We have a database of churches who are members of our organisation. People who are volunteers or employees of those churches also inherit membership by relationship. We are using a custom relationship type of 'Minister' to identify which individual related to each church is the lead vicar/minster/pastor/etc.
  
  [![Membership type table, showing how employees, volunteers and ministers should inherit membership.](https://i.sstatic.net/gcCSR.png)](https://i.sstatic.net/gcCSR.png)
  
  Some ministers are related to more than one church, and I am finding that the minister relationships are also causing memberships to inherit in the wrong direction. i.e. if a minister is with one member church, the membership will pass from the church to the minster, from the minister to any other churches they are with, and then on from those to every volunteer and employee of those churches as well.
  
  [![Relationship type table showing the custom 'Minister' relationship type.](https://i.sstatic.net/ZT4bd.png)](https://i.sstatic.net/ZT4bd.png)
  
  The membership type table definitely only has the A to B (organisation to individual) relationship included. Why is the membership also passing the other way from individual to organisation?
  
  **Edit: Full walkthrough**
  
  I have two churches: St. Tests, and St. Joseph the Tester. Both share the same minster, Testy McTestface, but St. Josephs also has a couple of other volunteers. Neither church, nor any of their related contacts, have any memberships.
  
  [![Relationship table for St. Tests, showing one relationship to the minister.](https://i.sstatic.net/opuB9.png)](https://i.sstatic.net/opuB9.png)
  [![Relationship table for St. Josephs, showing the minster and two additional volunteers](https://i.sstatic.net/4kYCh.png)](https://i.sstatic.net/4kYCh.png)
  
  I add a Church membership to St. Tests:
  
  [![Membership table for St. Tests showing new membership, and that one related membership has been created.](https://i.sstatic.net/1Avy1.png)](https://i.sstatic.net/1Avy1.png)
  
  A related membership is created for the minister contact, as expected:
  
  [![Viewing the primary membership for Testy McTestface, showing they have inherited their membership from St. Tests Church.](https://i.sstatic.net/0ZKll.png)](https://i.sstatic.net/0ZKll.png)
  
  But so is a membership for St. Josephs, the other church, through it's relationship to the minister of St. Tests.
  
  [![Viewing the primary membership for St. Josephs, showing a further membership inherited from St. Tests via the minister.](https://i.sstatic.net/hgrek.png)](https://i.sstatic.net/hgrek.png)
  
  And so are memberships for each of the additional volunteers associated with the second church:
  
  [![Viewing the primary membership for a volunteer with St. Josephs, showing a further membership inherited from St. Tests via the minister.](https://i.sstatic.net/JYB0D.png)](https://i.sstatic.net/JYB0D.png)
  [![Viewing the primary membership for a second volunteer with St. Josephs, showing yet another membership inherited from St. Tests via the minister](https://i.sstatic.net/z18nt.png)](https://i.sstatic.net/z18nt.png)
  
  **Edit: Further screenshots in response to questions**
  
  Second degree relationship permissions are turned off.
  
  [![Second degree relationship permissions are turned off](https://i.sstatic.net/fpViu.png)](https://i.sstatic.net/fpViu.png)
  
  These are all the CiviCRM extensions I have installed. I tried deleting the membership on the St. Tests example above (which, to confirm, also cleared all the others shown in the screenshots), disabling all these extensions, and then recreating the membership. The problem still occurred.
  
  [![Installed extensions: FlexMailer, Shoreditch, GDPR, Mosaico.](https://i.sstatic.net/S24LB.png)](https://i.sstatic.net/S24LB.png)
  
  These are the only Drupal rules I have. I'm using CiviMember Roles Sync to add an 'active member' role to current members, and display a warning to anyone who's had their membership deactivated.
  
  [![Active Drupal rules table](https://i.sstatic.net/RzUiA.png)](https://i.sstatic.net/RzUiA.png)
  [![Rule creating Drupal accounts for new members](https://i.sstatic.net/P9TBv.png)](https://i.sstatic.net/P9TBv.png)
  [![Rule displaying warning to cancelled/expired members](https://i.sstatic.net/GPw2q.png)](https://i.sstatic.net/GPw2q.png)
  
  **Edit: Some further testing**
  
  I tried changing the relationship type between the minister and the two churches from my custom Minister type to the built in Employer/Employee type, and the dodgy memberships persisted. In fact, the minister contact gained a second membership, one inherited from each of the churches he's employed by - even though only one has a membership of its own, and the second is inherited through the minster himself!
  
  When I then went ahead and deleted the original membership all the memberships across all five contacts disappeared. Recreating it, on either church, behaves as expected. Now I'm using the built in Employee relationship type, memberships stay within their own organisation. So it looks like it is something to do with the relationship type, but I've no idea what! Can anyone replicate?
  
  **Tags:** civimember, relationships
  
  > **Comments:**
  > **username_1**: That sounds really wrong ie what you are describing should not happen and have never seen this type of problem occur. It may be worth tracking through one example and confirm exactly what you can deduce from the 'related membership' info in the Membership tabs. (but you may have done that)  
  > **username_0**: Thanks. I've added a walkthrough of an example minister and their two churches. I guess it must be something to do with my relationship type, but I don't know what!  
  > **username_2**: Do you have second-degree permissions enabled?  (see https://www.screencast.com/t/VMWoNSkC7k )  That enables a second level of membership rolldown to occur.  
  > **username_1**: screenshots of your membership types confirm what you are saying about your 'inherited memberships' and also shots of your Relationship Types  
  > **username_1**: oh also confirm you don't have anything like CiviRules or Drupal (?) Rules kicking in and messing things up, or an Extension.  
  > **username_0**: Thanks, further screenshots added to address those questions. I can't see any reason the rules I have would cause this issue! Petednz, sorry, not quite sure if you're saying my membership and relationship type screenshots are sufficient to confirm the issue, or you're asking for something I've not given?  
  > **username_1**: only if your Rel. Type was somehow bi-directional eg you have the same label at both ends but still that shouldn't trigger something like this  
  
  ---
  
  ## 0 answers
  
  