Set a View's Context Inside an Organic Group
A very simple way to allow a view to display as if it were a page in an organic group on your Drupal site: Simply paste the code below in your view's Header or Footer, using the PHP Code input format.
<?php
og_set_group_context(node_load(46405));
?>Note: the node ID inside node_load() must be set to the group into which you'd like the view to display. To get this to function perfectly (as of OG 2.1), you might need to apply the patch in this issue on drupal.org: Group theme doesn't display on Views that take group as an argument. (Otherwise the group's custom theme might not get set).
There are some alternative methods to getting views to display inside groups, but this is a quick and easy solution.

Comments
I'm not quite sure why you would do this. What are you trying to accomplish?
This helps if you want to display a custom set of content or a slideshow (or something of the like) within an organic group on a Drupal site.
For instance, on this page – http://archstl.org/giving/online – there is a block on the left side for Stewardship and Development that doesn't show up unless the group's context is set properly.
Advancing the faith.
I don't suppose you have any idea on how to do this under Drupal 7, eh? It appears as though og_set_group_context has been deprecated and is not included in 7 ...
A lot of OG is different in Drupal 7 (it was basically rewritten from scratch)... so, not really :(
Web developer from St. Louis, MO. Personal website: Life is a Prayer.
Post new comment