All is in the title. :-)

I have added some (2) taxonomy vocabularies (sorry for my english) to forum post. In the function "forum_access_access" the tid is not always the forum one.

Dominique.

CommentFileSizeAuthor
#4 term_node.jpeg14.57 KBdme69

Comments

salvis’s picture

In the function "forum_access_access" the tid is not always the forum one.

It's not??? The forum_nodeapi() function in the core forum.module is pretty clear about what goes into the {forum} table:

    case 'insert':
      if (!empty($node->tid)) {
        db_query('INSERT INTO {forum} (tid, vid, nid) VALUES (%d, %d, %d)', $node->tid, $node->vid, $node->nid);
      }
      break;

Also, there's no other core module besides forum.module that mentions $node->tid.

Or are you saying that forum_access_access() is called with a $tid parameter that did not come from $node->tid? What caller would do that?

dme69’s picture

I don't know where is the problem. I jus saw this in this function.

Here is my case :

1 forum node with 2 term id :
- tid = 15 => this is a taxonomy term for tags
- tid = 64 => this is the forum term

Forum access is testing the rights for tid=15 not for tid=64. That's why it is not working for me

Dominique.

salvis’s picture

Please give me the file name / line number, paste the line and name the variable where you see 15 instead of 64. I'm still not following you.

dme69’s picture

StatusFileSize
new14.57 KB

Hello,

function forum_access_access($tid, $type, $account = NULL) {
  static $cache = array();
echo "TID = " . $tid; // My test

The result :
1. When showing the forum post (nid = 732)
My echo log qive this result : "TID = 16TID = 68"
2. When trying to add a comment to this forum post
My echo log give this result = "TID = 16TID = 16"
And I'm having a message that tell me I can't access this page

In attachment a screenshot of my database table {term_node} for this node.
The forum TID is 68. The others are tags.

salvis’s picture

Ok, now please add

if ($tid == 16) {
  drupal_set_message('<pre>'. var_export(debug_backtrace(), TRUE) .'</pre>');
}

below your echo.

This will generate a lot of output. You'll see "0 =>", "1 =>", etc., and I'm interested in the file path and line number reported after each of these. 0/1/2/3 should probably be enough.

EDIT: Should have mentioned that I created a vocabulary Color, enabled it for the Forum topic type, assigned Blue to a node, inserted your debug code, and never saw anything but the forum tid listed.

dme69’s picture

Sorry for the time to answer ...

The problem only appears when the tid of the forum is greter thant the tid of the tag

salvis’s picture

You hit a bug in core: #422218: $node->tid can get the wrong tid if a forum content type has additional vocabularies. Thanks for reporting it!

Please review the core issue.

I'm leaving this open as a signpost until the bug is fixed in core and a new version released.

dme69’s picture

Hello Salvis,

It seems to be ok for me now. I need some more tests but it seems ok :-)

Thanks for your help.
Dominique.

salvis’s picture

As long as core is not fixed, you're not safe if you use other vocabularies along with the forum vocabulary.

Please go to the core thread and at least show your interest in getting this core bug fixed!

salvis’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta3
Status: Active » Fixed

BETA4 includes a work-around for this core bug. #422218: $node->tid can get the wrong tid if a forum content type has additional vocabularies still ought to be fixed, of course, but Forum Access should now work as expected either way.

Status: Fixed » Closed (fixed)

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

salvis’s picture

I'm hitting this issue again while adding support for Nodecomment to Forum Access: when inserting a nodecomment node, FA needs to check whether its OP is a forum node. Again, FA cannot rely on $node->tid being the forum tid.