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

bryancasler’s picture

You'll also need this views patch #1081118: Taxonomy Term ID from URL

anonym-developer’s picture

Title: How to create a panel with related content from nodes, groups and terms. » ACCESS DENIED You are not authorized to access this page.

I get this instead of my content:

ACCESS DENIED
You are not authorized to access this page.

What could it be?

bryancasler’s picture

Title: ACCESS DENIED You are not authorized to access this page. » How to create a panel with related content based on multiple terms.

I 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

Create a taxonomy category (let's use "tags") and add it as a field to your node (field_tags).
Create a view
	Add a content pane titled "Related by Terms"
	On your content pane...
		Add under contextual filters "Content: Has taxonomy term ID"
			Choose "Provide default value"
			Choose "PHP Code"
			Use the following php code http://pastebin.com/SaU3dkNR 
			At the bottom check the box to "Reduce duplicates"
			Under the "More" category choose "Allow multiple values."
		Add under contextual filters "Content: Nid"
			Choose "Provide default value"
			Choose "Content ID from URL"
			Under the "More" category choose "Exclude"
		Add under fields "Content: Title"
		Save your view.
Now go to your panel's page and add the content pane you just created.
joshmbuck’s picture

Thanks 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

bryancasler’s picture

John, 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.

joshmbuck’s picture

Thanks. 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"

bryancasler’s picture

Looks 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.

suldan’s picture

Hello
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

bryancasler’s picture

Same 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.

suldan’s picture

Views

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

bryancasler’s picture

I'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?

suldan’s picture

no 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.

selwynpolit’s picture

Suldan, 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

suldan’s picture

[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

dasjo’s picture

using 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

Letharion’s picture

Status: Active » Fixed

@animelion Thanks for sharing :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jsncrg’s picture

Thanks Suldan for posting this. This has been a life-saver. I have been working on this issue for weeks.

Posted by suldan on July 16, 2011 at 8:21am

Views

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

drvdt’s picture

I love this http://drupal.org/node/1111384#comment-4742022
And I think this is best choice

mcfilms’s picture

I 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!.

katrien_w’s picture

Five years later #10 is still a life-saver. Thank you Suldan!

marcoka’s picture

#10 works great. thank you so much.