5

I am working with organic groups. Within each group, permitted users are allowed to create their own pages.

What my problem is that I need to set the audience for a new page automatically as the group the user is currently in. This is so that the user cannot manually change the group the post should go into but instead it's automatically and permanently set ( unless an administrator changes it ).

Does anyone know of a way that I might accomplish that?

1

You can use the prepopulate module to pass the group's gid to the node add form.
For example, the link will looks something like this:

node/add/discussion?edit[group_audience][und]=4

You could then hide the group selection box with css so the user cannot change it. For a more robust solution you would code a form hook. Here is an example.

  • I implemented hook_form_alter to set access to false for an element when not an administrator - before I read your solution. Thanks for your suggestions. – sisko Nov 28 '11 at 16:01
1

I like the idea of using a Rule and have gotten it to work using the following Rule config: Event=Before Saving Content, Condition=Content is of a Certain Type, Action: Entity=Node, Group=Site:Current-group - YES - works like a charm!

0

I know this is an old thread, but I found this in my own search.

I'm new to this, but I think this is going to work for me.

NEW "RULE"

Event = Before Saving New Content --- Node/Content type Action = Data/set data value/node:og-group-ref:0 (Groups Audience)

-1

With Drupal 7, you don't need the Prepopulate module.

You can just use this node/add/blog?og_group_ref=1 where 1 is the group ID.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.