Integrate with Domain Access
| Project: | Taxonomy Menu |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | domain access, taxonomy menu |
I use the Domain Access module on my site, along with Taxonomy Menu. I've resently noticed that even though I've told it to not show empty terms, empty terms appear in the menu. I believe this is because those terms, even though they do have associated nodes, those nodes haven't been allowed to be shown on the current domain through the Domain Access settings (example below).
This should be possible to do, as I also use Faceted Search, and it's taxonomy terms only show if the associated nodes are allowed on the current domain (i.e. the correct way). So it must be possible somehow...
Example: I create a holiday node and assign it the term 'swimming'. I also specify that it appears on the domain 'watersports.com'. I setup Taxonomy Menu on all my sites and tell it not to display empty terms (so that the term 'rock climbing' won't appear, as I haven't created any nodes for it yet). I view the menu on watersports.com and see it has 'swimming' listed, but not 'rock climbing' - as expected. I then go to my other domain (extremesports.com) and find that it displays the term 'swimming' (apparently because there is a node for that term), but because that node isn't shown on this domain, when I click on 'swimming', the resulting page says 'There are currently no posts in this category'.
Note, the above is simply an example - I don't own or have anything to do with those domains :)
Hope I haven't confused you, and that this will be a useful feature for others as well.

#1
I've read through the Domain Access documentation and taken a look at the code. I'm not sure how to do this yet and if it's possible.
Faceted Search only deals with displaying the terms. Taxonomy Menu save menu links to the database but doesn't handle how they are displayed in the menu. They are saved at a global level. I've reached out to the Domain Access group to see if they can lend any assistance.
#2
I have updated the latest version with what the Domain Access groups says should work. Please test.
#3
Ok, I upgraded to 6.x-2.1 (and had this problem: #410414: Update.php fails) but eventually got it installed ok.
I re-enabled my menus, only to find that no links are appearing in any of my taxonomy menus now... If I view the menu on the Menu > Primary Links page, I can see all the links under each menu item, bu they're all disabled. I'm assuming this is because it thinks they're empty and so doesn't show them (again, I've set the 'Hide empty terms' option).
This is true on all my domains, even those that are set to display all nodes...
#4
Try out version 2.2. I committed the incorrect code for version 2.1. Version 2.2 has what I meant to put in there in the first place.
#5
By the time I could get around to upgrading, version 2.3 was the latest, so I upgraded to that instead - but same problem...
#6
Ok. Thanks.
#7
I just made a commit that might help. Please download the dev version that will be dated after this post and retest.
Thanks again for you help.
#8
Nope, still didn't work.
I uninstalled the old version completely before installing the new one. I even selected to rebuild the menu on submit, but that didn't fix it either...
For an example of what's happening, see this site: http://tlctours.info/
If you scroll down, you'll see a list of activities in the left sidebar as part of faceted search. It only shows terms that have 1 or more nodes based on the current domain. The taxonomy menu is at the top of the page in the horizontal, yellow bar. All activity terms are listed there regardless of whether or not they're empty (see 'Golf'). This is the problem.
#9
Hi, I am also using the Domain Access module with Taxonomy Menu 6.x-2.x-dev and have the same problem.
I have tested Taxonomy List module and in the settings section (Count content), you can hide terms with no content. This might help with the SQL coding here?
To solve the problem, I have built an SQL View (see attached) which helps me do a simple SELECT … WHERE subdomain is the current domain name. Then I get the terms I need. The key is to display terms only where there is a connection with a node join ie. node has content and get the domain_id and/or subdomain. I hope this makes sense.
I would be happy to test any code you might be working on.
Thanks for your work!
Tim Jones
#10
Thanks Tim. The problem is that Taxonomy Menu does not control how the menu items are displayed, only how they are saved. This gives me a thought though. Can you look in the menu_links table for a menu item that does look correct and give me all of the rows on that table (I'm mainly interested in the options field).
Thanks,
Neil
#11
Hi Neil,
I dont have db access to do this at the moment, but check out the following (which you can cut and paste to try).
Here is my quick suggestion:
Step 1. Get the "domain_id" of the domain visited (in my example shown below, it is number 3).
Step 2. The following SQL will get all Taxonomy Vocabs and Terms from ONLY this domain :)
SELECT
domain.domain_id,
vocabulary.name AS taxoname,
term_data.name
FROM
term_node,
node,
term_data,
domain_access,
domain,
vocabulary
WHERE
term_node.nid = node.nid AND
term_data.tid = term_node.tid AND
node.nid = domain_access.nid AND
domain.domain_id = domain_access.gid AND
vocabulary.vid = term_data.vid AND
domain.domain_id = 3
In terms of what you need to do to populate the menu at the moment, all you need to do is a minor SQL tweak (JOINs) to the data being selected in your module which would populate the menu array for each site domain?
Let me know what you think?
Cheers!
Tim
#12
Any update on this?
#13
I've noticed there's now a later .dev version than what I'm currently running on my site. Is it worth updating to it to see if this is fixed, or has nothing been done on this yet?
#14
Sorry this module has changed hands. I'm not sure where indytechcook got on this. Can you go ahead and give the dev a try?
#15
Updated to latest .dev version, no change. Menus still display all terms even though nodes within those terms are not displayed on that domain...
Hopefully this can be fixed soon - the two modules are basically incompatible until this is solved.
#16
Sorry I didn't get to this. Life just got in the way.
#17
No problem Indy :)
As I've said above, the Faceted Search module handles its taxonomy terms properly in regard to Domain Access (not displaying terms on domains that don't have matching nodes).
However, I've searched through their code for any relevant references to 'domain access' or 'domain', but couldn't find anything. The same with a search for 'permission' (in case it was simply a permission you needed to check against).
Indy also asked the maintainer of Domain Access for help with this here: #406808: Taxonomy Menu Integration