Hi All,

I know this is me being dumb and missing something, but cannot see what.

I have OG and Views 2 set-up and working. Have done this dozens of times. Both work fine individually and I ahve used both for a while. I always have issues when trying to get a view to work for OG.

So what I have done is to build it up step by step.

1. Created a view that filters the node type only. This works fine and shows all node types over the entire site.
(saved and tested working at this point)

2. Added a relationship "Organic groups: Group node (post)"
3. Set the path to "groups/%/myview" (tried og/%/myview as well)
4. Added the argument "Organic groups: Groups" with a relationship to (2)
5. Saved
6. viewed groups/group1/myview - nothing, completly blank.

So obviously I have something wrong but not sure what. I have looked at the standard OG views, various forum threads, etc. but still cannot see what I have wrong. I have seen some posts saying change the validaor and others saying leave it. At present I have the default validator, but have played with it without any luck.

Can someone please point me in the right direction?

Regards,
Nick

Comments

steveadamo’s picture

For what its worth, this is my approach to displaying group posts (a custom content type for my groups) at groups/< group id >/posts:

BASIC SETTINGS
Name: Page 
Title: Post list 
Style: Unformatted 
Row style: Fields 
Use AJAX: No 
Use pager: Yes 
Items per page: 25 
Distinct: No 
Access: Unrestricted 
Caching: None 
Exposed form in block: No 
Header: None 
Footer: None 
Empty text: PHP code 
Theme: Information

PAGE SETTINGS
Path: groups/%/posts 
Menu: No menu

RELATIONSHIPS
None defined

ARGUMENTS
Organic groups: Groups

FIELDS
Node: Title 
Node: Post date Posted 
User: Name By 
Content: Post Default

SORT CRITERIA
Node: Post date desc 

FILTERS
Node: Type = Group Post 
Node: Published Yes 
nickbits’s picture

Thanks for the reply. There are only minor differences between yous and my set-up, but think you have hit the problem spot on. You noted in your path < group id >. I assume then when you want to view yours you go groups/543/posts?

If so, I think that is the issue, I want to be able to do it using the group name rather than the ID. I will check to see if it works with the group ID when I am at my dev machine. If this is the case, is there anyway to replace it with the group name rather than the ID? This is where the relationships should come in.

Thanks,
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

Not entirely clear exactly what you mean by "group name". This is available as an argument "Node: Title", but yes, you will probably need to pull this in via a relationship (since you are after posts in that group) and I'm not sure how special characters in the title are handled. You might want to bring in pathauto here somewhere if you use it, or your manually defined group URLs if you use them.

nickbits’s picture

By group name, I mean the name of the group. i.e. the title of the MAIN group node. As far as using "Node: Title" as an argument, there is no "Node: Title" in my argument list. The standard OG views allows the group name to be used (i.e. groups/group1), so it is obviously possible.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

nickbits’s picture

Almost cracked it. This is what I have:

1. Relationships set to - - Organic groups: Group node (post)
2. Arguments:
a) Argument - - Node: Title (Now that I have found it!!!)
b) Relationship - Group Node (post)
c) Case - lower case
d) Case in path - lower case
e) Transform spaces to dashes in URL - true (i.e. ticked)

3. Fields - whatever is needed...
4. Filters - Node Type = "whatever" - whichever node type is required.

It works, sort of. It does display what I expect it to, however, I loose all of the groups blocks so somewhere/how I am loosing the connection with the group. So now the problem is how do I get that back? OR what have I done to remove it? Obviously another setting in the views somewhere.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

izmeez’s picture

subcribing,

thanks for sharing your journey on implementing this.
sorry, i can't offer a better understanding of when the og blocks sense the og_context

izzy

nickbits’s picture

Hi,

No problem. I know it is something really simple, just find it frustrating it is not better documented or easier to find. Will keep everyone posted on this.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

>I know it is something really simple
It may be .. or it may not be quite that simple. Looks like OG has not managed to work out the "group context" (i.e. the active/related group). I'm looking at a View I have which lists content from a specified group and I'm quite impressed that OG has worked out the group context and is showing the admin block for the group in question. Probably it managed because the group nid is the argument, so when the OG argument handler fired it also "set" the group context.

I think the catch with what you are trying to do is that you are bringing in the OG stuff via a relationship, so the code to set the OG context has not fired. You might have to do it by hand somehow, in some PHP code that runs during building or rendering of the View. See http://drupalcode.org/viewvc/drupal/contributions/modules/og/og.module?a....

http://drupal.org/project/views_customfield would be one way of injecting the code, though the field would potentially "run" for each result in the View. Perhaps someone can suggest a better way.

nickbits’s picture

Hi,

At least your thinking the same as me, gives me some reassurance it is not something stupid I have done. I did look at adding some PHP code, but not sure what or where to put it. I am sure I read about relationships being able to do this, but cannot remember or find where I saw that. Anyway, will keep digging.

Thanks for the help and pointers.
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

steveadamo’s picture

ahh, you want to have groups/mygroupname/view...

while i didnt go that route for group content, i did do this for user views... for example, i have a path for the current users bookmarks like users/< user name >/bookmarks, which displays the custom bookmarks view for that user...

to accomplish this, i went a slightly different route using a view argument...

Action to take if argument is not present:
Provide default argument

Default argument type:
User ID from URL

Validator:
User

Type of user argument to allow:
Only allow string usernames

I havent tested it myself, but you could try something similar for your group URLs, so even if something is group/groupname/view, it would be interpreted as group/groupid/view... make sense?

nickbits’s picture

Not sure how as the OG stuff only allows for the ID. However, it may be possible using the node title. Will have a play.

Cheers,
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

nickbits’s picture

Unfortunatly the options to do that with groups is not there. Only Node ID's. The only other option that I know will work is to use node ID's and create an alias, but having to do that for each group would become a right pain.

I can see what the problem is, but not what or where...

So to recap, what we are aiming for is a view to be used with OG where you can use in place of the group ID in the path argument.

Cheers
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

I think the approach I suggested here http://drupal.org/node/650178#comment-2336484 should work but it would be a bit tidier if you could get the PHP (i.e. og_set_group_context($node)) to run from say the View footer. However I don't know how to access the View object from PHP code in the footer and hence get a hold the node object ... you would have to investigate the Views API to find the right function to call.

Another approach might be to use an Attachment display whose sole purpose is to set the group context. Probably I'd use Views Custom Field and have done with it. :)

nickbits’s picture

Hi gpk,

I am looing into that. I was hoping that there would be a simple way. Is this something that needs to be raised and integrated as a feature into OG or Views? I know other people have raised this very problem before and none, to my knowledged, have published a working solution.

Cheers,
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

>Is this something that needs to be raised and integrated as a feature into OG or Views
Without getting too intellectually involved (sorry, pressures of time!) it's not immediately clear to me "where" (i.e. Views or OG) there is a feature that could usefully be added. Perhaps OG needs an argument validator a bit like Users have? One snag I can see - there is no requirement for node titles to be unique, so you could potentially end up with a group that can't have a Views listing generated for it in this way.

Perhaps pathauto would be a way through, so that the group itself and the Views listings could use the same URL. There are ways of bulk generating URLs for existng content.

ludo1960’s picture

Trying to the same thing, very frustrating!!

nickbits’s picture

Hi gpk,

That was my issue as well, lack of time! Anyway, what I am now going to do is go back to basics. That is get a view working with the ID and just run with that until I have more time to deal with putting a name in. I didn't really want to go with pathauto, I know it would work but is an extra hassle and another thing to go wrong.

Anyway, like I said, I am going to go back to basics, then try moving forward to using the group name. I have started to delve into the code/API so I think I can possibly see a way of adding a validator in, but will require time that I cannot spare at present. There is a table somewhere that must store the GROUP NODE for each group, maybe a way forward.

Anyway, will keep everyone posted.

Thanks for the help, much appreciated.
Regards,
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

>I have started to delve into the code/API so I think I can possibly see a way of adding a validator in
Presumably you have checked the OG issue queue? Probably worth opening if feature request if there isn't one already so that others can also chip in with code/suggestions.

I'd compare the existing OG validator with that for user.module (which is bundled with Views) to see how usernames are handled.

>There is a table somewhere that must store the GROUP NODE for each group, maybe a way forward.
Well yes, {node} ;)
Also {og} stores the additional info about groups.
You shouldn't have to manipulate those directly though - usually everything can be done via the API functions provided by core and the relevant modules.

Actually for now if I were you I'd probably just do it using an Attachment display, and look upon it as an opportunity to work out what on earth it is that they do!!!

nickbits’s picture

Hi gpk,

I will open it as a feature request in the queue, but I wanted to have a look at how plausable this is and wait a week or so until I have a bit more time to start tha ball rolling.

Yes, it was the {og} table I was referring to. I always look at a table first and then the API. I know, a funny way of working but it works for me. And yes, will be looking at the username validator information/code.

I would like to thank you for the help and pointers, at least I know it is not me missing something, and will hopefuly let me code something (a new feature) that can be put back into Drupal to help others.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

WorldFallz’s picture

Just a guess-- but what about http://drupalcontrib.org/api/function/og_set_group_context/6 in the view header or footer (or template file for that matter)?

nickbits’s picture

Hi WorldFallz,

I did look at that, I believe it was mentioned in on of the previous comments. I could not get it to work, but do need to go back and try that again, when I have a clear head. I think it would have to be done in a template though as, correct me if I am wrong, you do not have access to all the node/php values in the header and footer of a view.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

WorldFallz’s picture

Yep I think you're right-- it will need to go in the template file.

nickbits’s picture

Hi All,

Using comments made here, I have progressed this one stage further. It was suggested twice about using the "Views Custom Fields" and "Attachment Display", with the original set-up (see initial post), I think I have a partial solution. Still needs work but here is what I have.

Addint an attachment, in that attachment I have added a custom field (PHP). The code added is:

<?php
$group_node = node_load('906');
og_set_group_context($group_node) ;
?>

So this loads the group node and then set's the group context. The 906 is the group ID for one of my groups. This does indeed set the group context perfectly. What is needed now is for a way to find the ID rather than hard wiring it. Noting, as mentioned previously that if we use the node title, we must put extra checks in place ( several nodes may have the same title). Shouldn't be too much of a problem if we make a few assumptions:

1. Group nodes are their own content type
2. Groups will never have the same title (I know it is possible)

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

>a way to find the ID rather than hard wiring it
Since your view type is Node rather than Group post you might just be able to apply the argument and relationship logic again but go for the group node rather than the posts in the group. There will only ever be one result ... Add the nid as a field, then add the custom (PHP) field after it and the nid will be available to the PHP code (install devel.module and try dsm(get_defined(vars)); if you get stuck).

Good luck!

nickbits’s picture

Hi gpk,

Thanks for that. I had just started to look at that as you posted. I think I have it but need to do more testing. The code I have is:

<?php
dsm($data);
$group_node = node_load($data->nid);
drupal_set_message("NODE ID - ".$data->nid);
og_set_group_context($group_node) ;
?>

I am off now, but will finish testing on Sat/Sun. Once I am happy it does work as intended, I will write up and post the solution.

Once again, thanks for the help, you are a gem.
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

>dsm(get_defined(vars));

Ooops, finger trouble, should have read dsm(get_defined_vars());

nickbits’s picture

Hi,

I finally got this working, although it is rather messey and probably is not the best way to do it. There are lots of other issues as well, such as post being in multiple groups, etc. Only a minor thing, but I ahve ignored that for the time being. I did try what you noted, but kept getting no results when changing the node type in the filter. Anyway, again starting with a working view (see first post) what I have done is:

1. Add in an attachment view
2. In the attachment:

a) Remove all the fields (MAKE SURE YOU OVERRIDE DEFAULTS)
b) Add "Node: NID" and ensure it has a relationship to "Group node (post)" - this will link it back to the primary group node
c) Add a customfield (PHP TYPE) with the code:

<?php
if (!empty($data->node_og_ancestry_nid)) {
  $group_node = node_load($data->node_og_ancestry_nid);
  og_set_group_context($group_node);
}
?>

d) change "Items to display" to 1 (MAKE SURE YOU OVERRIDE DEFAULTS)

3. Save it and you are done...

Not a perfect solution, but it works. Does have some flaws, i.e. it assumes the first node filtered belongs to the correct group, doesn't take into account a post may belong to multiple groups, etc.

I am now going to go and use the group ID as the argument rather than the name as a stop gap, it works, is the default and more importantly, I have not got a lot of time to spare and need to move forward. However, I will continue to work on this issue, and may look to see if I can add such an option into the Views system itself (would benifit more people but will take much longer).

Again, thanks for the help everyone.
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

Just to check - is your View of type Node or Group post?

nickbits’s picture

Hi gpk,

If you are referring to the "View Type" when you create the view, I only have "Node", there is no "Group". I may be misinterpreting what you are asking, if so I appologise.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

I *am* referring to that :) , you should have a list of options when you create the View, including Node at the top and Group posts 2nd or 3rd down.

Assuming it is of type Node you should be able to modify your Attachment view so that it picks up the group node via the argument rather than a post that might potentially be in multiple groups...

nickbits’s picture

Hi gpk,

There is definatly no "Group post" on my page when I create a new view. I am using the latest OG and Views releases (not Dev). I ahve tried various configurations with the argument, none were sucessful, but am still playing with it.

Cheers,
Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

gpk’s picture

Oh I see what you mean, that option was removed in 6.x-2.x (I'm still running 1.x on my live site because of a couple of unresolved regressions).

The good news is that you should be able to get the attachment View to work properly (i.e. not relying on a group post being in the "right group"). You might need to override the default View arguments, then remove existing arguments and add a new one on Node -> Title, with basic validation (important! since otherwise you will get restricted to nids). If you want you can then (of course) filter on Group node types/change other settings as necessary.

ludo1960’s picture

..tried following this to the letter, without success. I must be doing something fundementally wrong!

You say "Anyway, again starting with a working view (see first post) what I have done is:"
Eh, post 1 wasn't working!

Here's what I did:

Added a view of type node: (no such thing as a view type Group post gpk!)

Post 1 says "1. Created a view that filters the node type only. This works fine and shows all node types over the entire site.(saved and tested working at this point)" Not entirely clear to me!

Does that mean a node view with a filter on the content type for Group Posts?

Step 3 in Post 1 says "Set the path to "groups/%/myview" (tried og/%/myview as well)"

I take it you must add a page view prior to this step? Again not obvious!

Anything wrong with the above? If not the I am ready to proceed to your recipe. If all is successful, say I have a table in og_php_ron for a particular group showing group post titles, what should be the format of the link to get the detail view of the post?

Oh man, this is confusing!

nickbits’s picture

Hi ludo1960,

Confusing, you aint kidding. When I set out to do this I thought i would be easy. Some one did say (elsewhere) jsut use url_alter and sub_path_alter (not sure of the exact name of the latter) but nothing. Anyway what I have done, from scratch is (NOTE YOU ALSO NEED Views Custom Field module installed):

1. Create a view (node type).
2. Add a page display
3. Set the path to "groups/%/whatever"
4. Add a relationship - "Organic groups: Group node (post)"

5. Add an argument
5A. Add an argument - "Node Title"
5B. Set the relationship of the argument to "Group node (post)"
5C. Set "CASE" and "Case in path: " to "Lower case"
5D. Put a tick in the "Transform spaces to dashes in URL" box.

6. Add the fields and filters that you need for your view. Anything you like...

7. Add in an attachment view
8. In the attachment:

a) Remove all the fields (MAKE SURE YOU OVERRIDE DEFAULTS)
b) Add "Node: NID" and ensure it has a relationship to "Group node (post)" - this will link it back to the primary group node
c) Add a customfield (PHP TYPE) with the code:

<?php
if (!empty($data->node_og_ancestry_nid)) {
  $group_node = node_load($data->node_og_ancestry_nid);
  og_set_group_context($group_node);
}
?>

d) change "Items to display" to 1 (MAKE SURE YOU OVERRIDE DEFAULTS)

9. Save it and you are done...

That is all I ahve. I will post again in a bit with the export from my view, will allow you then just to import it directly and use that as a base. I would love for there to be an easier method, perhaps there is and we have all missed it!

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

nickbits’s picture

As promised, the exported view:

$view = new view;
$view->name = 'og_podcasts';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
  'group_nid' => array(
    'label' => 'Group node (post)',
    'required' => 0,
    'id' => 'group_nid',
    'table' => 'og_ancestry',
    'field' => 'group_nid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
  'title' => array(
    'label' => 'Title',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'exclude' => 0,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
  'field_audio_file_fid' => array(
    'label' => 'Audio',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'label_type' => 'custom',
    'format' => 'swftools_no_file',
    'multiple' => array(
      'group' => TRUE,
      'multiple_number' => '',
      'multiple_from' => '',
      'multiple_reversed' => FALSE,
    ),
    'exclude' => 0,
    'id' => 'field_audio_file_fid',
    'table' => 'node_data_field_audio_file',
    'field' => 'field_audio_file_fid',
    'relationship' => 'none',
  ),
  'tid' => array(
    'label' => 'Category',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'type' => 'separator',
    'separator' => ', ',
    'link_to_taxonomy' => 1,
    'limit' => 1,
    'vids' => array(
      '3' => 3,
      '1' => 0,
      '2' => 0,
    ),
    'exclude' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
  ),
  'group_nid' => array(
    'label' => 'Groups',
    'alter' => array(
      'alter_text' => FALSE,
      'text' => '',
      'make_link' => FALSE,
      'path' => '',
      'alt' => '',
      'link_class' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'trim' => FALSE,
      'max_length' => '',
      'word_boundary' => TRUE,
      'ellipsis' => TRUE,
      'strip_tags' => FALSE,
      'html' => FALSE,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'type' => 'ul',
    'separator' => ', ',
    'exclude' => 0,
    'id' => 'group_nid',
    'table' => 'og_ancestry',
    'field' => 'group_nid',
    'override' => array(
      'button' => 'Override',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'title' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => 'Title: %1',
    'breadcrumb' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'glossary' => 0,
    'limit' => '0',
    'case' => 'lower',
    'path_case' => 'lower',
    'transform_dash' => 1,
    'id' => 'title',
    'table' => 'node',
    'field' => 'title',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '3' => 0,
    ),
    'relationship' => 'group_nid',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_image_size' => '_original',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'groups' => 'groups',
      'feed' => 0,
      'feed_item' => 0,
      'image' => 0,
      'audio_podcast' => 0,
      'event' => 0,
      'groups_post' => 0,
      'news_item' => 0,
      'page' => 0,
      'story' => 0,
      'test' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '2' => 0,
      '3' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_transform' => 0,
    'validate_user_restrict_roles' => 0,
    'image_size' => array(
      '_original' => '_original',
      'thumbnail' => 'thumbnail',
      'preview' => 'preview',
    ),
    'validate_argument_is_member' => 0,
    'validate_argument_php' => 'dsm(get_defined_vars());',
    'override' => array(
      'button' => 'Override',
    ),
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'audio_podcast' => 'audio_podcast',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('footer_format', '4');
$handler->override_option('footer_empty', 0);
$handler->override_option('items_per_page', 50);
$handler->override_option('style_plugin', 'table');
$handler->override_option('style_options', array(
  'grouping' => '',
  'override' => 1,
  'sticky' => 0,
  'order' => 'asc',
  'columns' => array(
    'title' => 'title',
    'group_nid' => 'group_nid',
  ),
  'info' => array(
    'title' => array(
      'sortable' => 0,
      'separator' => '',
    ),
    'group_nid' => array(
      'separator' => '',
    ),
  ),
  'default' => '-1',
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'groups/%/podcasts');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));
$handler = $view->new_display('attachment', 'Attachment', 'attachment_1');
$handler->override_option('fields', array(
  'nid' => array(
    'label' => 'Nid',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_node' => 0,
    'exclude' => 1,
    'id' => 'nid',
    'table' => 'node',
    'field' => 'nid',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'group_nid',
  ),
  'phpcode' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'strip_tags' => 0,
      'html' => 0,
    ),
    'empty' => '',
    'hide_empty' => 1,
    'empty_zero' => 0,
    'value' => '<?php
if (!empty($data->node_og_ancestry_nid)) {
  $group_node = node_load($data->node_og_ancestry_nid);
  og_set_group_context($group_node);
}
?>',
    'sortable' => '0',
    'exclude' => 0,
    'id' => 'phpcode',
    'table' => 'customfield',
    'field' => 'phpcode',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'audio_podcast' => 'audio_podcast',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'override' => array(
      'button' => 'Use default',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('items_per_page', 1);
$handler->override_option('attachment_position', 'both');
$handler->override_option('inherit_arguments', TRUE);
$handler->override_option('inherit_exposed_filters', FALSE);
$handler->override_option('inherit_pager', FALSE);
$handler->override_option('render_pager', TRUE);
$handler->override_option('displays', array(
  'default' => 'default',
  'page_1' => 'page_1',
));

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

ludo1960’s picture

..for that, even I can follow that!

The missing bit is the link from the og_ghp_ron master view to the group post, any ideas?

Cheers again!

nickbits’s picture

Hi,

Excellent. Not sure what you mean, I did not have any link on og_ghp_ron. What I did do was create a menu item linking to my view, using the OG Menu module.

Let me know if that is what you are talking about or not...

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

ludo1960’s picture

.. what I intended to do with this view you created was to have a link from the group home page (og_ghp_ron) (that shows all posts in that group), then on say the title of each post would be a link to the new view. So the million dollar question is how to create that link? Does that make sense? Or does that open yet another can of worms?

Ludo...

nickbits’s picture

Hi,

Corrct me if I have misunderstoof, but you want the titleview of all nodes on the standard group homepage to link to a view instead of the node?

If so, (I have not tested this so no gaurantees it is right, let alone work):

1. create a clone of "og_ghp_ron" (NOTE the clone name must start with og_ghp_ )
2. Change the row style to node
3. Add in any fields you need
4. On the title node, enable "Output this field as a link" and set the options required.
5. Save the view
6. change the OG home page to the view you just created (admin/og/og?destination=admin%2Fog)

Give that a try. If not, am not too sure...

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

ludo1960’s picture

..indeed correct....

4. On the title node, enable "Output this field as a link" and set the options required.

That is the million dollar question, the "Output this field as a link" should link to the new view.

What is the correct syntax for this link?

nickbits’s picture

Hi,

Good question, I don't have a good answer though! Afraid I am not too sure about that, if you can link path auto into it or not. There is another option just above "re-write output" which may let you use php to work the path used for linking.

Nick

------------oOo----------------------
Nick Young (www.nickbits.co.uk)

geerlingguy’s picture

Subscribe - I wish there were an easy tie-in for this :-/

__________________
Personal site: www.jeffgeerling.com

mxt’s picture

Subscribing.