I open this as a new issue because http://drupal.org/node/404978 got silent.
This might help sorting this out

When I enable the taxonomy_term view, it gets used to display terms selected from the Group categories block (as this happens to Core taxonomy node selection).

The posts are correctly displayed accroding to this view, but the group context is lost, obliging to select again the group after each term selection.

This might be the answer to http://drupal.org/node/708912

Thanks

Comments

jvieille’s picture

Category: bug » support

Trying to revive this thread.
I tried everything possible to get the taxonomy_term view - which emulates the standard Drupal display for terms, offering the possibility to customize the display - working with the OG Vocab Group categories block. The OG group context is lost as soon as one hits a term.
I tried the default argument with group context, php code..., filter, etc... no way.

If someone has succeeded at this, I would be very glad to benefit the experience.
Thanks

jvieille’s picture

There don't seem a huge interest for this... quite strange!

I really tried everything, there was no way to keep the context from the Group Category block using a view with a path.
Because it was really critical for me to master the taxonomy browsing display in OG, I finally decided to swim a little bit in PHP coding and found a rather simple) solution. I am really not skilfull enough in PHP, Drupal and CVS to submit a patch, so I just tried to show the diffs with +/-

In og_vocab.module:

function og_vocab_block_view() {
  $group_node = og_get_group_context();
... 
-    $tree = array_slice($tree, 0, 20); // removes a puzzling 20 terms limitation
...
// change to pass group argument
-    $items = og_vocab_build_list_items($index = 0, $tree);
+    $items = og_vocab_build_list_items($index = 0, $tree, $group_node->nid); 
...
// change to handle group argument
- function og_vocab_build_list_items(&$index, $tree) {
+ function og_vocab_build_list_items(&$index, $tree, $gid) { 
...
// add group argument in the path to term views
-     $term_path = "taxonomy/term/$term->tid";
+     $term_path = "og/term/$term->tid/$gid";
...
// add group argument in each item
-      $items[] = array('data' => $item, 'children' => og_vocab_build_list_items($index, $tree));
+      $items[] = array('data' => $item, 'children' => og_vocab_build_list_items($index, $tree, $gid));

This basically
1) gets rid of the 20 items limitation making this block unusable (this limitation and the absence of complaints might indicate that nobody uses the Group category block) - I have vocabs with 200+ terms, it works perfectly.
2) add the OG context to the item path so the url passed to the view will be og/term/tid/gid

Then a clone of the taxonomy_term View is modified as follow:
path: "og/term/%"

Arguments:
Taxonomy: Term ID (with depth)
Organic groups: Groups / Node ID from url

With this modification, OG Vocab no longer works with the core Drupal taxonomy display which responds to the original path "taxonomy/term/%"
This is because OG context has to be passed as an argument, which conflicts with the variable "depth modifier" argument that needs to get out.
It might be possible to overcome this problem by a smarter handling of arguments, but my Drupal and Views knowledge stops here.
If it is not possible, then OG Vocab would have to come with a View as described above (and so will have a dependence to Views)

Hint1: Look at what Taxonomy menu has done, offering the choice of the default core handling and custom view, to be set in config by the user so each vocab can have a specific view
Hint2: OG Vocab block could be a submodule of Taxonomy-menu as both modules share a lot in common.
Taxonomy menu as the advantage to be menu based, so DHTML works

If the maintainer or someone else interested and competent enough could approve the change and submit a patch, this would be a path toward a great usability improvement of OG Vocab.

Now, I am perfectly happy with OG and OG Vocab!!!

ensemble’s picture

Category: support » feature
Status: Active » Needs review

I actually just came here to post that I had found a solution, but mine is nearly identical to yours! It works for out site, and makes group vocabularies much more user-friendly.

this_is_it’s picture

jvieille, u are really a life saver.

haha, i love u...

jvieille’s picture

Keeping on top of my list
This is a deadly needed feature!
adding to this request
http://drupal.org/node/877558
I had to move away from this block and implement it another way:
- defining one block per vocabulary using Taxonomy Menu
- Condition its visibility using

<?php
$node = og_get_group_context();
if ($node->nid == XX) {
  return TRUE;
  }
else {
  return FALSE;
  }
?>

where XX is the group nod ID where this vocabulary bock will be allowed to appear

Though this allow great looking browsing and Views display, this far from ideal because it needs a manual setting each time a group is added.

cray146’s picture

subscribing

mingliang’s picture

hi Jvieille, could you explain why you gave up your previous solution and create the view yourself? Are there any significant problems of your original approach? You answer is highly appreciated. Thanks.

jvieille’s picture

Actually, I was returning to it.
The other problem I complain is
http://drupal.org/node/877558

But the manual workaround in #5 was unbearable as soon as group creation is under users' control.

greta_drupal’s picture

I feel your pain. I have had the exact same issue (using OG, OG Vocab, OG Menu), and worked for many weeks on it. Tried many different variations of arguments, and menu paths.

In my case, I have 5 views pages that all are displayed together on one view page as tabbed pages -- generated through the Views menu tab options (no add'l module). By using Term ID, I can get a correct river-of-news page, but the tabs won't work. It seems that the Views menu path fails with the arguments. (If I take the same view and hardcode the filter (with Term) and the views menu path, as well a page menu link, the page displays as desired. But, need it to be dynamic page built by the menu.)

But, also, as you have found, the view page loses OG context, so the OG Menu (vocab/tax) menu will not show on that Views page. Odd, because the group name (perhaps stored as GID) is a select field in the OG Vocab configuration. Why isn't that then passed in the URL? Maybe it is, but there doesn't seem to be a way to access it in Views.

I keep clicking that Arguments + hoping that a "GID by URL" will magically appear. Even better, og_name, which is a token for taxonomy.

It seems to me that one should need only OG Vocab + OG Menu to build a dynamic view to pull OG nodes, based on the variables passed through URL.

I also tried with Taxonomy Menu, but abandoned it in favor of OG Menu. (Just couldn't get the custom path correct with Taxonomy Menu, but maybe should give it another try.) Have you tried OG Menu?

Also tried cloning the og_ron (river of news), especially because client intially wanted the group node combined on the page with the dynamically-generated OG-term tab pages. But, again, I just couldn't get the views menu tabs to work with that view, and the tabbed content is a requirement of the design.

I feel close to a solution (too idealistic??). But, I have tried so many different variations, I'm all turned around in my head. Have engaged the discussion on IRC several times (incl. troubleshooting with merlinofchaos), and have posted to Views and local Drupal groups -- no response, and stumped a couple other developers with this one.

I too am surprised that others haven't posted about this. It does seem like a deficiency in OG.

If you still need this functionality, I'd be happy to have someone to brainstorm it with. (Contact me directly.) Here are the modules that I am using:

Drupal 6.22
Views 6.x-2.12 (Views 3 too unstable)
Organic groups 6.x-2.1
OG Block Visibility 6.x-1.x-dev (2011-Feb-25)
OG Menu 6.x-2.4
OG Vocabulary 6.x-1.x-dev (2011-Feb-25)

greta_drupal’s picture

UPDATE: The taxonomy_term view can be modified to achieve tabbed pages (where default tab path is "taxonomy/term/%"), and work with OG menu. But, only the default tab will keep OG context. As soon as user clicks another tab (which has a path format of "taxonomy/term/%/tab2"), any accompanying OG blocks -- such as OG Details, OG Menu -- are lost.

NOTE:I tried the OG Vocab patch (#2) described herein, and it failed -- no data at all was displayed. Also tried using Taxonomy Redirect module to 'trick' OG; no solution. And, have tried Views 3 (particularly new argument context options).

It sure seems that I have tried every Views variation.

It really is odd that OG explicity establishes content types to be group node types, but yet that context is so easily lost. Too bad. Quite a shortcoming (with OG and/or these OG-related modules).

jvieille’s picture

greta_drupal, have you modified your view as indicated in my post?

greta_drupal’s picture

yep, tried it...as best as my scenario would allow. (see my notation about what I did try.)