I had some trouble figuring this out, so I wanted to share my solution to not only spread the wealth, but also to find out if there is a simpler way to do this.
1) For content related to the current group being viewed
Create a views pane
Add Contextual Filter "Fields: group_audience - gid".
Provide default value "Current group from context"
Edit argument input.
Choose "From context"
Required context "Group ID" under the Organic Groups group header
Check "Context is optional"
In your panels view
Add the Contexts
"Group from OG context module"
Add the Content
Add your previously creates views pane
When the configuration window pops up for the pane
Choose "Group from OG context module" from Fields: Posted to (group_audience) - gid
2) For content with the same tag as the currently being viewed taxonomy term
3) For content with the similar taxonomy in common as the current (non-group, non-term) node being viewed.
Create a views pane
Add Contextual filter: "Taxonomy: Term ID".
Provide default value "Taxonomy Term ID from URL"
"Load default filter from term page"
Check the box for you vobaularies
Choose "1+2+3 (for OR)"
Edit argument input.
Choose "From context"
Required context "Term ID" under the Taxonomy Term header
Check "Context is optional"
In your panels view
Add the Contexts
"Taxonomy term from Node on field_tags field"
*field_tags will be the name of your tagging field on your node
Add the Content
Add your previously creates views pane
When the configuration window pops up for the pane
Choose "Taxonomy term from Node on field_tags field" from Taxonomy: Term ID
*) To add some more configuration options you can do the following
In your views pane
Change "Allow settings"
Check "Items per page", "Title override", "Use exposed widgets form as pane configuration"
Add the filter criteria "Content: Type"
Check "Expose this filter to visitors, to allow them to change it."
Check "Allow multiple selections"
Comments
Comment #1
bryancasler commentedYou'll also need this views patch #1081118: Taxonomy Term ID from URL
Comment #2
anonym-developer commentedI get this instead of my content:
ACCESS DENIED
You are not authorized to access this page.
What could it be?
Comment #3
bryancasler commentedI ended up finding a simpler way to do this. Give this method a try and let me know if it works.
*You may or may not need to add this patch to views. I suggest trying without it.
#1081118: Taxonomy Term ID from URL
Comment #4
joshmbuck commentedThanks for posting this...it's very helpful.
BUT, I am having a bit of a problem.
I don't seem to have "Content: Has taxonomy term ID." I used "Taxonomy: Term ID," but now I get a complete list of all my node titles, regardless of taxonomy.
Any thoughts?
Thanks,
Josh
Comment #5
bryancasler commentedJohn, to see "Content: Has taxonomy term ID." you'll need to be on views 3.x, the terminology is different in 2.x
I'm also running into a similar problem as you described on another site. I've been trouble shooting it, but I've had no success. Additionally the PHP doesn't seem to work on Organic Group pages. So I'm currently looking for a solution to that as well.
#1167870: How to create a view with related content based on multiple terms. Working for nodes, but not groups.
Comment #6
joshmbuck commentedThanks. I don't mean to sound like an idiot, but how do I get Views 3? I'm using views-7.x-3.0-beta3. Also, I'm not using panels...does that matter?
I'm doing pretty much everything you did, but instead of "Content: Has taxonomy term ID" I'm using "Taxonomy: Term ID"
Comment #7
bryancasler commentedLooks like you already have views 3 installed. I'm still working on this, but if I find anything new to share I most certainly will.
Comment #8
suldan commentedHello
I can't get panels to provide multiple terms/tids from the active node.
I have tried both ways constructing a view to display nodes related to multiple taxonomy terms shown by animelion.
In both cases the view does the job well. When I pass the arguments directly into the view or over the panel [arg1+arg2+etc] the related nodes show up.
But I can't get panels to provide multiple terms from the active node.
When I tell panels to pass the argument "taxonomy term from node > term-id" only one argument is provided.
So I tried "multiple terms from node > term ID of all terms separated by +" (Context Setting is OK) but then the view returns nothing.
How can I get panels to send multiple arguments (tids) to the view? As written before: when the view gets the right arguments the related nodes are showing up.
Have tried 2 days by now
I'm stuck - Need help
regards
suldan
Drupal 7.4
Panels: last dev release
Views: 3.0 rc1
Comment #9
bryancasler commentedSame here, not sure what changed but this solution doesn't work anymore. I'm also trying to find a new way to do it, so if you have success please share.
Comment #10
suldan commentedViews
Contextual Filter: Taxonomy Term ID
Provide default value > Taxonomy Term ID from url > Load default filter from node page > Filter to items that share any term
When the filter value IS available or a default is provided: Specify validation criteria >Taxonomy ID > Filter value type: Term ID's separated by , or +
Allow multiple values
Relationship should be created when saving view (cool stuff) > "Taxonomy terms on node"
Other > Query settings > Distinct
Add view to panel (node template) > no need to pass any arguments
It works for me
Greets
Suldan
Comment #11
bryancasler commentedI'll give this a try today, woot! Hope it works. Did you need the patch, or did you do all this without the patch? Also what version of Drupal, Views, Panels and Ctools are you using?
Comment #12
suldan commentedno patch - but dev versions:
Views 7.x-3.x-dev 2011-Jul-13
Panels 7.x-3.x-dev 2011-Jun-01
Ctools 7.x-1.x-dev 2011-Jul-16
Question: is there a way to visualize the arguments sent by panels? This was like fishing in troubled water.
Comment #13
selwynpolit commentedSuldan, thanks for your suggestions. I'm trying to do the same thing but I am using non dev versions of panels, views and ctools. Any ideas why I can't seem to make this work? I get a seemingly random couple of matching nodes even though I know there are more.
Selwyn
Comment #14
suldan commented[This is no longer a panel issue]
I don't think it is random. Probably only one argument is passing the query. Try out the preview with contextual filters inside views. Don't forget the nid-filter (or delete it for testing). Get the tid's from database and pass them. Try if it works with only one argument (this should work). Then multiple arguments separated by +.
good luck
Comment #15
dasjousing current dev versions
#8 is true
#10 doesn't work
created related bug #1285012: Panels context issue with contextual filter: Has taxonomy term ID doesn't work with multiple terms
Comment #16
Letharion commented@animelion Thanks for sharing :)
Comment #18
jsncrg commentedThanks Suldan for posting this. This has been a life-saver. I have been working on this issue for weeks.
Comment #19
drvdt commentedI love this http://drupal.org/node/1111384#comment-4742022
And I think this is best choice
Comment #20
mcfilms commentedI just wanted to post a "Thank you" to Suldan too. Although a few of the labels have changes a little in Views, and I had to skip this part "When the filter value IS available or a default is provided: Specify validation criteria >Taxonomy ID > Filter value type: Term ID's separated by , or +" because I could find it. It ultimately worked great anyway
Thanks!.
Comment #21
katrien_w commentedFive years later #10 is still a life-saver. Thank you Suldan!
Comment #22
marcoka commented#10 works great. thank you so much.