Hello.

I use forum_access and unitag modules and I had an error in the preview or save each node:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(td.tid) FROM term_synonym ts INNER JOIN term_data td ON (ts.tid = td.ti' at line 1 query: SELECT td.name, DISTINCT(td.tid) FROM term_synonym ts INNER JOIN term_data td ON (ts.tid = td.tid) LEFT JOIN forum_access fa ON td.tid = fa.tid LEFT JOIN acl acl_fa ON acl_fa.name = td.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 = 2 WHERE ((fa.grant_view >= 1 AND fa.rid IN (2, 11)) OR fa.tid IS NULL OR aclu_fa.uid = 2) AND ( LOWER('woman') LIKE LOWER(ts.name) AND td.vid = 5) in file public_html/sites/all/modules/unitag/unitag.module in line 298.
and at the same time unitag not worked as it should.

Then I looked at the code of forum_access.module and found these lines:

function forum_access_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
  global $user;
  if ($primary_field == 'tid' && $user->uid != 1 && !(strstr($_GET['q'], 'admin/content/forum') !== FALSE && user_access('administer forums'))) {

When I added condition "$_GET['q'], 'forum') !== FALSE", error no longer occur
Now I have this code:

function forum_access_db_rewrite_sql($query, $primary_table, $primary_field, $args) {
  global $user;
  if (strstr($_GET['q'], 'forum') !== FALSE && $primary_field == 'tid' && $user->uid != 1 && !(strstr($_GET['q'], 'admin/content/forum') !== FALSE && user_access('administer forums'))) {

I understand that I made not quite correct changes, but I don't use terms of forum anywhere except the forum.
Please consider this problem and find the right solution.

Comments

salvis’s picture

Status: Active » Postponed (maintainer needs more info)

What makes you think that this is an issue of Forum Access rather than unitag?

Your approach is not correct. If access to a vocabulary is controlled, then it must be controlled everywhere, not just on pages that happen to have 'forum' in the URL. For example, it must be controlled on user/UID/subscriptions/taxa (defined by the Subscriptions module), which is a taxonomy listing that may or may not include the forum vocabulary.

but I don't use terms of forum anywhere except the forum.

That may be true for you but certainly not for everyone.

quotesbro’s picture

I see... thanks for quick answer.
I just thought that perhaps there is a way to verify that is used forum's vocabulary and rewrite query only in this case.

salvis’s picture

Category: bug » feature
Status: Postponed (maintainer needs more info) » Closed (works as designed)