Suppose I am building a twitter-like site, and allow members to form groups with OG. So I have set up a view to list all the posts in a given group. However, I would like to embed a content creation form in the header (similar to how twitter is at the moment) with group audience set automatically to the group (therefore is not shown as an option in the form). Is there a way to do it without writing code (I haven't been doing drupal module development after D6...)?
It doesn't have to be in the view header. Just place it block above the view and adjust the css so they sit together.
Rules will allow you to create a new node, set the current OG_context as the new new node's group and then redirect back to the same page or to the new node.
So based on @Niall Murphy's answer, my solution to the problem is as follows:
- Instead of embeding the form in a view, I create an entity form and make it available as a block with entity forms block module. Then the block is shown in all the group content type node.
- Also, in order to prepopulate the group id in the block, I installed Organic Groups Entityform Integration for that purpose.
- Then I use the rules module to capture the form submission event, and then check if it has the fields in the entity form. If the fields exist, then I create a new content. Then the value value of the content is copied from the submitted form. Lastly, the form itself is deleted as they are not needed anymore.