Group based visibility / privacy

Hi everbody! I am new to Ellg and just learning the data model and structure, so please have patience. :)

I am trying to build a social network where users can only see each other if they are in the same group and content should only be visible to the members in the same group, but to all groups the user is in. Quick Example:

3 groups: Mountainbiking, Dancing, Music

4 users: A, B, C,

  • A is member of Mountainbiking and Dancing
  • B is member of Dancing and Music
  • C is member of Music
  • D is member of Mountainbiking
  1. A posts something on Wire, B can read it because of group Dancing, D can read it because of group Mountainbiking
  2. C searches for other people and can only find B because of Music
  3. B is looking at the activity feed and only sees activities from A because of Dancing and C because of Music.

So basically, everyone should see everything from members of the same groups. However for non-members the user should be completely invisible, until they join one of their groups. The groups should not be used for discussions, only for creating these privacy and sharing levels. So my questions are: Is this even possible with groups or do I have to take / write another plugin? If so, what kind of approach would you suggest? Do I have to create some kind of new Data Set of Ellg Entity for this? Is there any best practice solution?

Thanks you so much and apologies already, if I oversaw an existing solution!

  • By the way, could somebody maybe move this to technical support please? 

  • I moved it to the plugin development group.

    You would need to develop a custom access system to achieve this kind of functionality. The standard access system has a series of privacy levels (private, friends, logged in users, public). You would have to write something that does this through group membership.

    Alternatively, you could only allow users to post content in groups (rather than having individual content) and make all the groups closed. This is much easier to implement.

  • '" or non-members the user should be completely invisible, until they join one of their groups.. ' implies that the Members PlugIn also will need to be aware of User's Groups and incorporate  permisioins and acceses from there. The RiverDash Activity and other PlugIns that display other members' content will all need to do the same.On the positive side.. to and for my awareness knowledge of Elgg Internals' workings -- all this can be achieved by inserting the correct logic as needed.


  • Thanks a lot guys!

    Cash: When I use your alternative way, would users be able to see content posted among other groups? It should feel pretty natural just posting your content on your wall and only the preselected groups can see it. I can't image how that could work. 

    So your first solutions seems to need heavy modifying of the core. Could you maybe hint me in the right direction where to start? What files need to me modified, I just don't know where to look for the right stuff yet.

    DhrupDeScoop: When I modify the access levels, don't these plugins inherit them automatically from the core?


    How is it when I try it the other way around? Make all content public and just block it from certain people? So in reality the access should be location-based, rather than groups. Users should just be able to block their content from certain locations / cities. They will have a (verified) location field in their profile. Every user can then select what locations / cities can't see their content (they don't want people from their hometown know about emberassing stuff).

    So the access blocking would be dependent on a profile field. Is this easier to implement?

  • Sorry to bring this up again, but haven't really figured it out yet. So I looked a lot at the code the last days and I guess it would be best to do it this ways: I somewhere have to find the exact function that tells the system whether a user has access to certain content. There I just add a WHERE and see if a share by the owner's content has been set to the caller's location.


    User with ID 1 wants to look at user's content with ID 2. U1 is from location X. U2 has set up shares for users from locations X, Y, Z. So somehwere I would have to add something like WHERE U2.location = U1.share

    Just don't know where... :/