I think I have read everything about OG Context in Views, but never succeeded at using Views with OG excepted when the View was driven by an OG aware module that sends the appropriate argument or seems to care about OG context.
I must be missing something, so after too many hours of head scratching, I would appreciate an expert eye on what I am trying to do.
I have set a very simple View that is supposed to show the nodes for a particular term. The settings are the following:
Arguments
----------
Taxonomy: Term ID
Organic groups: Groups / Provide default argument /Current group node from context / Basic validation or Group node - Node ID
Filters;
-------
Nothing or Organic groups: OG: Posts in current group =
Path :
------
og_tags/%
Values examples:
---------------_
term ID in a group vocabulary: 368
group node ID : 462
When I test the view in edit mode
- entering the argument 368 as a term ID in a group returns nothing - which is normal as no context prevails while editing a view
- entering in addition the group ID (368/462) returns the nodes filtered as expected.
When I test the view when I am on the group (gid 462) page, either from a menu item "og_tags/368" or typing manually the url "www.mysite/og_tags/368", the context is immediately lost and an empty page is displayed.
Thanks for help
Comments
Comment #1
dawehnerI guess you need to add the node:nid argument from the group.
But this is a support question for OG. Views does not know anything about the views integration of OG.
Comment #2
jvieille commentedThanks for taking care and redirecting appropriately.
Do you mean an additional argument that also defaults to current group context from node? - that did not help...
Comment #3
dawehnerNo a node: nid argument, and you change the links url to og/tags/GROUPID/termid
Comment #4
jvieille commentedThanks, but that means I know the group ID when issuing the link.
I don't. I am not a php coder and I would think that a so obvious and simple requirement (using Views in OG) should work out of the the box.
I thought that the default argument "Current group node from context" would guess automagically what the current group is, passing it to the view that would keep it while displaying the node list....
If it doesn't do that, I really don't figure out in which circumstance it would help.
Again, I think I really miss something: I did not found other complaints and I cannot believe than nobody uses Views with OG...
.
Comment #5
amitaibuThe context is lost because you are on a custom path.
You should change your 2nd argument to be php code and use:
Comment #6
jvieille commentedThanks a lot, but where this code should be copied to?
By the way, I am trying to use Taxonomy menu that call a view with a single argument as the term ID
(the OG Vocab handles the context, but does a weird job, not using Views, not usable for me)
Comment #7
jvieille commentedI found the way to set an argument in PHP.
So I set the second argument "Organic groups: Groups" as default with a type "PHP code" (the first stays the term ID)
That did not help much.
Now, when calling the view with the term ID argument from the group it is relevant, I am redirected to another group...
I am sorry to be so dumb, am I looking for something that nobody normally need - basically using Views in OG?
By the way, why this post has been renamed "Getting OG context on custom path"? What would be a non-custom path?
Thank you so much for your help
Comment #8
jvieille commentedThis is not yet fixed...
Still no way to keep context when calling a View - nothing works to date.
Thanks for help
Comment #9
amitaibuset the second argument to be node: nid
Comment #10
jvieille commentedNo way.
I set the following argument
1 Taxonomy: Term ID
2 Node: Nid (default argument, php code as indicated)
and path og_tags/%
When I call this path with a term id attached to a post in the group, the context is lost on the spot and the view returns nothing.
I only succeeded at getting something by inverting the 2 arguments:
1 Node: Nid (default argument, php code as indicated)
2 Taxonomy: Term ID
In this case, the view returns the correct nodes, but the context is lost
Also, setting the default argument as php with this code or selecting "Current group node from context" seems to be equivalent
Comment #11
jvieille commentedAdditional thoughts after Looking again to some indications in Drupal Discussion and the issues I experiment:
1) I could manage to kee the context ONLY when calling a View from within the group main page only, setting a path tha add a tab to this page.
2) It seems IMPOSSIBLE to keep the context when calling a View from a menu item - everything discussed is not for this situation, but when the view is called from within a group node or a node in the context of a group
3) I found something here:
http://drupal.org/project/context
I don't really understand what the "context module" does, but I found this discussion which seems to be a possible solution for OG
http://drupal.org/node/689972
#13 even propose a specific module that might be what I am looking for.
Just a little bit surprised: aren't really there almost anybody using View in OG??? (except for the very specific situation of filling up the main group page)?
Am I still missing the point, or am I getting closer to a real issue?
Comment #12
marcp commented@jvieille - For this issue, please do not bring the Context module into the equation. If you can give exact steps to reproduce the problem we'll be able to help you. Exact steps are, for instance:
1. Install Drupal 6.16
2. Install OG
3. Install Views
4. Enable views, og, og_views
5. Anything else you do between now and when the problem occurs. Keep it simple so that we get the minimum amount of work to reproduce the issue.
Comment #13
mxtSubscribing, I've similar issues keeping OG context outside OG pages, in particular with Views and OGUR.
See my post:
http://drupal.org/node/742676 where yhahn suggests to resolve the issue using Spaces OG & PURL modules (I'll try in next days)
Also see:
http://drupal.org/node/759264
http://drupal.org/node/737292 and in particular http://drupal.org/node/737292#comment-2846284
MXT
Comment #14
jvieille commented@Marcp
Scenario (1)
Setting Taxonomy menu for a group vocabulary, with a custom view (single argument term ID)
Adding a second argument as indicated everywhere using all methods (node nid, group, group from context, PHP...):
Nothing goes out, context is lost
Scenario (2)
Calling this same simple view directly from the browser, typing the path and the term Id as argument:
- Nothing goes out, context is lost
Adding the group nid as second argument:
- correct behaviour, the nodes are displayed and the context is kept - but I cannot do anything with that...
Scenario (3)
Using the Group category block, editing the taxonomy_term view by adding the second argument as mentioned above
- Does not work, context lost
I am almost giving up. What I am looking for is not that exceptional. This post might be more explicit:
http://drupal.org/node/774468
Any help would be appreciated
Thanks
Comment #15
marcp commentedSounds like you must be using og_vocab from the 3 scenarios you mentioned -- is that right? If so, this issue belongs there.
Also, if you are able to provide exact steps to reproduce the problem ... see above ... that will help the maintainers of whatever project this pertains to. Your descriptions of the problem are fine, but without exact steps it's impossible to reproduce.
Comment #16
jvieille commentedYes, this is all with OG Vocab
Scenario 3,
----------
the steps are the following:
- Define a vocab for a group, define some terms and tag some nodes in this group with these tags
- Enable the Group category bloc
- Everything is fine, you can browse the group nodes which are tagged on this vocabulary, keeping the current group context
Now, you are not happy with the way the nodes are listed and you wish to customize the listing of nodes.
- enable the "taxonomy_term" view which by default provides the exact same function than the Drupal core taxonomy node listing. If this would work, it will be possible to customize the node listing at will
- try again browsing from the Group category bloc
- When clicking on a term, you get the same listing as before, but you are thrown out of the group.
You are somewhat disappointed but not desperate and fervently look in the forums to learn about this "context" issue with views that seem to be addressable. Actually, there are default arguments that are supposed to pass the context to Views even if the path to calll the view is not context aware.
This is where I am stuck. Nothing succeeded to date.
Scenario 2
----------
Having failed at getting the Group category bloc working with Views, you decide to go simpler
With the same environment,
- create a simple view that list the nodes from a term
- define a first argument with Term ID and e second argument with Groups: group
This works fine, you can list the nodes for the term in the group
Now, make the second argument as default with group context from node or the PHP code that is advised from pklace to place
- try to call the view by typing its path from the group main page
- if you only type the term ID, the context is lost - meaning that the default argument does not play the game
- if you type both the term ID and the group node ID, everything is fine.
Scenario 1
- Enable Taxonomy menu for the group vocabulary, custom path to the previous View
- The taxonomy menu list correctly the terms, click on one term
- while the number of node is displayed, no node is listed on click, context is lost.
Comment #17
marcp commentedWhen you say:
what do you mean exactly? Are there blocks that are supposed to display for your group? Is the theme supposed to change? If you are talking about the theme, then #698238: Organic groups vocabulary term display does not get the group theme is a duplicate of this.
When you switch the Project for this issue to OG Vocabulary, you'll need to reset the Version and Component. It would be best to look through all the OG Vocabulary issues and search for any patches that may address this. Also, you should try the latest dev release or the version from CVS to see if it hasn't been fixed but not yet released.
Comment #18
jvieille commentedI don't play with themes, just using the standard OG Vocab Group Category block.
I just installed the latest OG Vocab dev, but no progress.
I am switching to OG Vocab, which seems more relevant.
This now looks like a bug - or a missing feature?
Yet another post on this list!!! May be if a solution is found, a couple of issue might go off...
http://drupal.org/node/605138
http://drupal.org/node/404978
http://drupal.org/node/774468
http://drupal.org/node/708912
http://drupal.org/node/763308
http://drupal.org/node/748626 (because the "post_by_term" will not be useful anymore)
http://drupal.org/node/724288 (already duplicate)
http://drupal.org/node/698238 (may be)
OG and OG Vocab are really great, if only such a (apparently) minor issue could vanish...
Thank you in advance for looking at this
Comment #19
jvieille commentedI am really lost here.
I would appreciate some help
Thanks
Comment #20
jvieille commentedI found a solution
http://drupal.org/node/763308#comment-2962022
Comment #21
greta_drupal commentedHaving the same issue. My response and what I've tried
here: http://drupal.org/node/763308#comment-2962022