I have a vocabulary with some terms assigned to domain A, others terms assigned to domain B. In general terms visibility is restricted correctly based on domain A or B, however when "exposing" the taxonomy term in a view's filter, all terms (not only terms assigned to domain A or B) are exposed in the term selection drop-down menu.

Comments

GenghisJuan’s picture

I have this same issue.

Exploratus’s picture

Me too...

Exploratus’s picture

Has anybody been able to resolve this? THe only think I can see is to make different vocabularies for different domains, but that is an extra step that seems unnecessary. Any help will be much appreciated.

Thanks

skizzo’s picture

Not a general solution but... if keeping a single vocabulary and adding multiple pages (one for each domain) is ok for you, then you can add the exposed "Taxonomy: Term" field (term ID, not Term name). Then, if you select the Vocabulary and Dropdown option, you will be given the option to manually pick the "right" subset of exposed terms. For sure, adjusting the settings when new terms are added to the Vocabulary will be a PITA, but I have not found a better solution. Hope this helps...

Exploratus’s picture

THere has got to be another way... This means I will have to have an additional view and an additional page (from panels) for evey exposed filter that has a taxonomy that is dependant on a domain. If I have 10 websites and I have 5 exposed filters in each domain, that's an additional 10 times the work becuase of one taxonomy field on the entire site. bahumba...

davemybes’s picture

I have managed to get this working by hacking a file in the Views module. In the folder views/modules/taxonomy, edit the file views_handler_filter_term_node_tid.inc and change line 119 (in Views 6.x-2.10):

$result = db_query("SELECT * FROM {term_data} WHERE vid = %d ORDER BY weight, name", $vocabulary->vid);

to this:

$result = db_query(db_rewrite_sql("SELECT * FROM {term_data} t WHERE vid = %d ORDER BY weight, name", 't', 'tid'), $vocabulary->vid);

In my case, I was allowing all terms from the vocab to show in the list. Depending on your settings, you might also need to edit line 122 to look like this:

$result = db_query(db_rewrite_sql("SELECT td.* FROM {term_data} td INNER JOIN {vocabulary} v ON td.vid = v.vid ORDER BY v.weight, v.name, td.weight, td.name", 'td', 'tid'));

However, I don't know if the line 122 change actually works.

Technically, I think this is a bug in Views, as its not allowing the term list to be changed by access control modules like this one.

skizzo’s picture

Project: Domain Taxonomy » Views (for Drupal 7)
Version: 6.x-1.0-rc1 » 6.x-2.11

a big thanks!!! I am moving this to the Views queue for further comments/actions. The problem was exposed in Domain Taxonomy (which "extends Domain Access (DA) functionality to taxonomy objects").

dawehner’s picture

A patch for both 3.x and 2.x would be fine.

davemybes’s picture

StatusFileSize
new738 bytes

Here is the patch for 6.x-2.11. I have not included changes to the code at line 122, because I have not tested that part.

dawehner’s picture

Status: Active » Needs work

I think everything should be included

davemybes’s picture

StatusFileSize
new1.01 KB

OK, here it is with the extra SQL query updated too.

dawehner’s picture

Status: Needs work » Reviewed & tested by the community

Looks fine for me

Exploratus’s picture

So this will allow an exposed view in a filter with terms assigned to different domains (with Domain Taxonomy) to sort by their appropraite domain settings rather than show every single one? If, so Ill test it...

davemybes’s picture

If by "sort by" you mean "it will only show terms that are assigned to the current domain", then yes :)

Exploratus’s picture

Works great! Applied the patch and started working ASAP as it was supposed to. Taxonomy terms assigned to a domain are now recognized by views... So much for having to repeat my work three times with every view. YAY!

Exploratus’s picture

I think I found one problem. If one has additional taxomomy terms exposed that are not domain dependant in a different exposed field, then only the last taxonomy term will appear on thet list. For example

I have a neighborhood that is domain dependant and a restaurant type that is not. After applying the patch, the domain dependant one works fine. but the one that is not domain dependant, it will only show the last value, and thats it...

I realzed after a little work, that I needed to assign domain setting to every vocab and term, even those available to all domains.. Terms that were not assigned to a domain were not showing up.... So what I made those available on all domains and it startsed working as expected.

I hope that was clear enough.

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 6.x branches -- I assume this isn't an issue for 7.x since db_rewrite_sql is gone.

I'm a little concerned this could backfire on us and sometimes we don't *want* to respect that. Maybe there needs to be an option to rewrite or not.

dawehner’s picture

Additonal i fear that people might need this, but cannot alter it because it's a simple query and the query alter is just added to comlex queries with db_select etc.

Status: Fixed » Closed (fixed)

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

Exploratus’s picture

Status: Closed (fixed) » Active

In views, it seems that if we select Taxomony All terms field and a node from domain A is appearing on Domain B with a taxonomy term from Domain A, the link to the node term page links to Domain B rather that Domain A.

If a taxonomy term and a node from Domain A is appearing on Domain B, the taxonomy term link should link to A, not B - just like the node does if source is set to A.

skizzo’s picture

Check the rewrite/do-not-rewrite setting in Domain Taxonomy's advanced setting.
In anyway, i guess that above comment #20 does not belong to this (Views) issues queue.

iamjon’s picture

Status: Active » Closed (fixed)

Changing status based on comments 21 and and 17.