How to remove group audience and content visibility-field if user is in one group only

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Castor-designs's picture

I have a basic group called “all-users” to which registred users are assigned to by the Rules module.
Now its not intuitive and makes no sense to the user, when he has to set group audience and content visbility while creating an entry.
The only option in the group audience field is “all-users” ofc, and if he sets content visibility-field to “private”, it makes no difference since everybody registred on the site is in the “all-users” group. So users will wonder and get irritated by these fields.

The reason why I need the fields is for certain users, which are, beneth the “all-users” group, in a private group, let us call it “private group alpha”. Private group alpha is a closed club, in which just certain users may provide content. They may decide by the content-visibility-field, however, that they want to provide the content as well to the public. (Group-Audience only is no option, cause there are certain fields in the content of Private group alpha, which not even public viewers can see, even if its set to public, cause of the group-audience. Ignore this note, if you dont understand what I mean. It doesnt matter anyhow)

So waht I want to achieve is, that a user, which belongs to one group only, does not have to change group-audience nor does he have to set content-visibility.

Is such a thing possible? I have thought about the Rules module but I am not sure, if it is possible with that.

Thanks for any help in advance.

Comments

Still looking for help :)

Castor-designs's picture

Still looking for help :)

Solutions

simon_j_nichols's picture

As always there are going to be several ways to do this.

First you could have two types of content- with and without organic groups. Simply let the regular users create the og-free content. Problem solved.

Second you could assign the og-group by context or by entity reference pre-populate (see the module of the name and the og documentation pages) by adding the og_group_ref value to the url of the link to create the context or alternatively just by coding it into an hook_content_node_alter function. Same goes for the visibility field. You can check if the user is in the private group you could then set the visibility field as visible or hidden and if hidden you could hard code the field as public. Of course you need to be comfortable doing a bit of code.

Thank you very much. First

Castor-designs's picture

Thank you very much. First version is not possible since I need features of OG also for all registred users.

Second version sounds interesting. Unofrtunately I lack the skills of doing stuff like this because I used to read php only and code html/css only :D So that will be a problem but I will have a look I guess.

If you feel like it, you could try and help me out a little bit with specific information about the steps that are to be done :)

Thank you very much for the answer!

coding / configuring the solution

simon_j_nichols's picture

for the first part take a look at

https://www.drupal.org/node/1895578

to see how to automatically assign a group. After that you really need a developer with some experience of og. Its not that hard but you need to do some basic design, for example to decide how to identify the private group (probably by name NOT by nid) and then to understand the og data structure / entity api mapping to be able to check the users for group membership and set basic og variables. Doesn't look madly difficult but I haven't got direct experience so I don't want to misdirect you

Organic groups

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: