Ok, I feel really stupid for having to ask this, so hopefully someone can tell me what daft mistake I've made quickly so I can bury my head in the sand.


1. I have Organic Groups installed and two content types assigned to Group home page node types (Foyer and Society).
2. I have no trouble theming CCK content types and the node-news.tpl.php in my theme directory works perfectly. I have node-og.tpl.php in the same directory.
3. It seems to me that I should be able to use if($node->type=='foyer') and if($node->type=='society') to generate different themes for Foyer Groups and Society Groups, in which different CCK fields are pulled from the database and (potentially) different content is presented in the View for River of News.


I cannot for the life of me alter anything on the default group home page layout, and I do not understand how node-og.tpl.php is meant to work when the content type templates can also be modified by node-foyer.tpl.php or node-society.tpl.php.

What I've tried:

  1. I tried creating a view and changing the OG Presentation Style to it. I have og_ghp_foyers which generates a page view to foyersview and the first $arg is Group NID. When visiting foyersview/7, Views correctly displays a teaser list of (CCK type) News nodes (currently I only have the one).
  • When I change the views Filter settings to exclude News nodes, I notice that the teaser disappears from the group home page.
  • However, when I change anything else (to full node, list view etc.) the foyersview/7 page is updated accordingly, but the group home page reverts to the default teaser view.
  • I don't understand what's going on here (why the view settings should sometimes but not always affect the group home page) and I'd appreciate some explanation.
  • I tried editing node-og.tpl.php but nothing happened when viewing the group home pages (for either of the content types). This is hugely frustrating as again I have no idea what is incorrect about this.
  • I tried editing node-foyer.tpl.php and the edits work as expected (I can extract CCK fields and thus theme the page as I want), except I do not know how to include the River of News feature. I tried looking in og.module but nothing sprang out at me.
  • I think you are meant to theme/customise the group home page using Views and node-og.tpl.php, right? I would appreciate some guidance on my approaches above.
  • Eventual aim:

    1. I would like to have a

    in which various CCK fields are shown (eg. field_postcode from Foyer type).
    2. There should be another
    which includes the View og_ghp_foyers. I would edit this to exclude various content types, but essentially the View should generate a list of all recent content promoted to that group and output a teaser list (or something which mimics it - would the correct approach be to theme a list view?).

    I have spent the last ten hours searching for a solution to this, but I finally give up. If anyone could help me out, I'd be really grateful.


    166533’s picture

    I found this code somewhere else and just came across it again in a useful snippets file. I added it to node-foyer.tpl.php and adjusted my View to suit. If you have the first argument set to Group NID, the following code means that the View returns the correct data for the group you are viewing.

    $view = views_get_view('og_ghp_foyers');
    print views_build_view('embed', $view, array($node->nid), false, false);

    If anyone could explain to me what's actually going on with this code, I'll write up my take and submit it to the handbook. It seems to me that Drupal users would benefit hugely from some basic explanation of PHP where it's relevant to them. I don't understand PHP myself, but I've picked up things through having someone explain to me what certain snippets do in a manner that means I can later alter it myself. Anyway.. this appears to work..

    discursives’s picture

    it sounds like you created a view called og_ghp_foyers and in that view you have an argument for Group NID.

    Is that correct? Can you post a reference to where you found this?

    I want to do more embedded views, and I am buried under an OG CCK type right now. I'm trying to get a nice body field to print, and the $content variable for the OG page appears to pull in a whole bunch of data and I can't control it very well.

    I'd like to use views, and find some way of printing out a few of the more useful og default collections of content.

    At this point,my biggest issue is that my OG CCK type has a body field, and that seams to be getting printed twice by $content without any help form me. Fascinating!