I have several views that have exposed taxonomy term in drop downs that only work with either this module turned off or with that role having "administer nodes". I did some digging and if i add a forum_access record for a term not in the forum vocabulary, then that terms ID shows in the view filter dropdown ( the name for it doesn't doesn't however - i just get an extra blank entry. ).

I think the issue is in the forum_access_db_rewrite_sql method but i couldn't seem to get it to behave any differently when messing with it.

i am using the most current version of drupal, views and forum access (advanced forum too). what should i do next to trouble shoot this issue?

CommentFileSizeAuthor
#6 bad1.png30.36 KBpolluxmr2
#6 bad2.png15.43 KBpolluxmr2
#6 good.png26.76 KBpolluxmr2
#5 taxonomy001.png26.85 KBkaring

Comments

karing’s picture

I'll try and reproduce this. Please tell me exactly which versions you're using of the modules involved.

polluxmr2’s picture

Forum Access 6.x-1.8
Core 6.26
Advanced Forum 6.x-2.0-beta1

and also Taxonomy Access Control 6.x-1.3 that might be getting in the mix but i can't say for certain.

edit: and ACL 6.x-1.4
edit #2: the perm 'administer nodes' gets the dropdowns in the view to populate as one would expect but for obvious reason i don't want to grant that to every user.

sadashiv’s picture

Assigned: Unassigned » sadashiv
Status: Active » Needs review

I was facing the same problem and i have following modules installed

Forum access 6.x-1.8
Core 6.22
Advanced Forum 6.x-2.0-beta1
ACL 6.x-1.4

I debugged the forum_access_db_rewrite_sql hook for finding the reason and found that when we expose taxonomy terms in views this hook gets called for building the query and as authenticated or anonymous users don't have the above(administer nodes or administer forum) permissions and he is not on forum create page so the else part gets executed i.e.

else {
$required_access = 'view';
}
and
$sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid
LEFT JOIN {acl} acl_fa ON acl_fa.number = $primary_table.tid AND acl_fa.module = 'forum_access'
LEFT JOIN {acl_user} aclu_fa ON aclu_fa.acl_id = acl_fa.acl_id AND aclu_fa.uid = $user->uid";
$sql['where'] = "(fa.grant_$required_access >= 1 AND fa.rid IN ($roles)) OR fa.tid IS NULL OR aclu_fa.uid = $user->uid";
$sql['distinct'] = 1;

Here the sql query is joined with forum_access table which fails the condition and returns no results may be hence we get a exposed taxonomy with only "Any" as option.

      if ($user->uid == 1
        || user_access('administer nodes') && strpos($_GET['q'], 'node/add/forum') === FALSE
          || user_access('administer forums') && $_GET['q'] == 'admin/content/forum'|| empty($args)) {
        break;
}

I added the above code i.e. || empty(args).

When this hook is invoked from views module we get args as empty.

edsel’s picture

Status: Active » Needs review

Sorry that did not work for me...:(

Edit: Working now, error was due to something else :)

karing’s picture

StatusFileSize
new26.85 KB

Would you please confirm the following steps should reproduce what you're observing:

1. views/edit/advanced_forum_topic_list
Filters + Taxonomy: Vocabulary exposed
Create Page display

2. on that Page - masquerading as a user (with role that has NO administer nodes permissions) - the issue is that I would not be able to select any of the Taxonomy: Vocabulary options when I click on the select box (current value = Forums).

As in (screenshot):
screenshot

Can't reproduce this as of yet - things are working fine when masquerading as such a user - but I have some small version diff-s for the modules at play here. Will systematically update them to figure out if/when things break. But let me know if these steps should reproduce what you're observing. We need a specific test scenario for this.

-- KarinG

polluxmr2’s picture

StatusFileSize
new26.76 KB
new15.43 KB
new30.36 KB

I did as sadashiv suggested. However, before i did it i captured the default behavior in screenshots.

KarinG, here are some screenshots before i made any changes. bad1 is a list of terms and bad2 is the list of vocabularies.

good1 is a list of terms after i applied the changes that sadashiv suggested. My only concern is that i see some terms in there that should be locked down by FA but i will double check my setups because there are 15 potential terms/forums locked down by FA but i only see 3 in the list that shouldn't be there so chances are i missed something and its not something else.

thanks everyone for the help!

karing’s picture

Status: Needs review » Active

Thanks for the screen shots - I've been able to reproduce the issue with the latest -dev: 6.x-1.8+1-dev

3. Added a second Filter: + Taxonomy Term ID (with depth).

4. Masquerading as user w/ role that has Forum Access permissions: the user can select (and Apply) terms from the Taxonomy Vocabulary - but can NOT select from the Taxonomy Term ID (with depth). shows but select terms underneath that are 'blank'.

5. Adding 'administer nodes' permission to the role that the user belongs to does allow the user to select terms from the Taxonomy Term ID (with depth).

I'll have a detailed look at the code tomorrow.

karing’s picture

Status: Needs review » Active

Sorry - ran out of time to look at this today - have slotted it in for tomorrow.

RedRat’s picture

I have absolutely the same problem: when I turn on Forum Access, all my users can't use taxonomy in exposed filters. I have installed a testing site with Drupal 6.26, ACL 6.x-1.4, Forum Access 6.x-1.8 and Views 6.x-2.16, so I can test any patches to solve this nasty bug.

karing’s picture

I've also confirmed that #3 does solve the problem - but I'm wondering if there may be better ways to go about this. salvis is on a (well deserved) vacation. I'm sure he'll have a peak at this shortly after he returns. Thanks everyone for helping to detail this.

sadashiv’s picture

I agree with you. Need to debug more and find a more precise way to fix this problem. The change suggested by me is just a workaround which i came up with and i have not explored all options available.

salvis’s picture

Status: Active » Needs work

(commenting from Madagascar without any code insight)

We probably need to limit the filtering to tids that belong to the forum vocabulary.I think there's even a separate issue requesting that, but it wasn't convincing enough.

batdesign’s picture

I had similar issues with exposed Views taxonomy filter dropdowns having no options for anonymous users.
Adding to the .module file with the code in #3 fixed (after a cache flush).

salvis’s picture

Assigned: sadashiv » Unassigned
Status: Needs work » Closed (works as designed)

This is a Views bug. The fix for it was committed on 2011-11-17 as a result of #1040744-8: Only one term available in exposed "Taxonomy: Term ID" filter widget..

As dawehner wrote in #14:

You either have to download views 2.x-dev or wait for a future views 6.x-2.17

Unfortunately, 6.x-2.17 has never seen the light of day, and the -dev version has been hidden.

BTW, I had found this before in #1041168-6: exposed filter not populated with taxonomy, not using forum vocabulary, but I had forgotten about it — I've put it on the front page now.

P.S. We've wasted a couple more hours of our lives on this. I wouldn't mind if everyone went over to the Views queue and complained...

batdesign’s picture

Reopened #1040744-8: Only one term available in exposed "Taxonomy: Term ID" filter widget. in Views issue queue so hopefully the patch will get moved into a dev branch and a 2.17 will appear eventually.

salvis’s picture

Version: 6.x-1.8 » 6.x-1.x-dev
Category: bug » support
Status: Closed (works as designed) » Fixed

Status: Fixed » Closed (fixed)

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