Showing the wrong post count in the forums.

Great little module - Many thanks for your hard work.

I have done some searching on this and have found a few threads in the past, but they seem inactive now.

Im using Drupal D7.7

Just to let you know that the bug still persists (at least for me) and wondering if there is maybe a patch that I have missed somewhere that manages to fix the issue?

Using your module it seems to be reporting the wrong count for users and anonymous, however admin can see the correct count.

Forgive me if there is a thread already started on this - I did search :-)

Best wishes

Comments

salvis’s picture

Thank you for reporting this. While we've had this problem with D6, the corresponding code in D7 (core and FA) is completely new, so a new issue is just right.

As before, however, I think this is an issue in core, not in FA, but let's keep watching this and hopefully found out more about it.

Babymaggie’s picture

Thanks Salvis for your response and speedy reply. It's a very neat module like you say lets keep watching!

All the best

GatorBat’s picture

I recently began exploring using ACL along with Content Access and Forums Access to restrict access to Forums and other areas of a dev site instead of using Taxonomy Access Control. I too have noticed that once I enable the Forum Access module, the Topic Count and Post count indicate double the amount of each (I have 1 Topic with 6 posts, but once Forum Access shows 2 Topics and 12 Posts). I am running advanced forum as well, which was listed as compatible on this module's main page.

If I simply disable the module (uncheck it and save, uninstallation is NOT necessary) - Any/All roles list the number of topics and posts correctly. Once the module is enabled, only User 1 can see the correct number of topics and posts.

I found the only way to give another Role the ability to see the topic/post counts correctly was to give it the "Bypass content access control" permission - which of course, defeats the purpose of this module. Even if a member has full rights to all Forum and Advanced Forum permissions, and can admin both content and content types - the topic/post counts are still doubled.

Thanks in advanced to salvis (and the rest of the community) for the hard work on this module

danweasel’s picture

I ran into this as well, running:

Advanced Forum
Forum Access
ACL
Taxonomy Access Control

except that topic/post counts were being multiplied by 5. Disabling Forum Access removed the issue, which is mostly okay since I'm using TAC to do the heavy lifting of access control. The only reason I had Forum Access there was to remove disabled entries from the forum taxonomy when moving a topic.

In any case, I'm not sure it's a pure access control issue, it may be specific to Forum Access.

(crossposted from the current core issue http://drupal.org/node/1241854)

GatorBat’s picture

Just curious if there were further developments about post counts being incorrect for all but user 1. I updated both ACL (Oct 12, 2011 Dev) and Forum Access (Oct 30, 2011) to their latest dev versions, and the problem I mentioned in #3 still exists.

salvis’s picture

No, nothing new really, so far.

@danweasel: Have you also tried to temporarily disable TAC? Did that make any difference?

ifish’s picture

I'm also having the same problem.

It just doubles all the posts and topics when activated.

ifish’s picture

Priority: Major » Critical

Please fix this. This is very huge problem.

All authenticated users see everythnig doubled, also if reading topic thread the paginator doubles up and start displaying empty threads.

Only admisn see it correctly.

salvis’s picture

Priority: Critical » Major

So far it's unclear whether there are always additional node access modules involved or just FA and ACL.

It would also help to know whether you're using moderators or not.

ifish’s picture

Currently all that is needed is to be able to make forums private.
I am using no other access module, I've tried (Taxonomy & Node Access) modules also, but they seem to do the same, double up.

Forum Access doubles up count after the "Edit Permissions" task has been performed.

salvis’s picture

I've tried (Taxonomy & Node Access) modules also, but they seem to do the same, double up.

That seems to indicate that it's a core issue rather than a Forum Access issue.

Forum Access doubles up count after the "Edit Permissions" task has been performed.

I don't know what you mean with "the 'Edit Permissions' task". Always state paths (URLs without the host name).

I don't see any doubling up on my test site. Others have reported counts multiplied by 5. It must depend on the exact configuration of (all of) your roles, and we need a fool-proof (and easy) way to reproduce the problem.

If it really is a core issue, then we should be able to create a test using the \modules\node\tests\node_access_test.module that demonstrates the problem. That is a mandatory step on the way to getting it fixed. The node_access_test.module is normally hidden on the modules list, but you can make it visible by removing the

hidden = TRUE

line from the node_access_test.info file.

salvis’s picture

Title: Forum post count wrong » Forum count incorrect when using access control modules, now for D7
Project: Forum Access » Drupal core
Version: 7.x-1.0-beta1 » 7.x-dev
Component: Code » node.module

I worked for more than hour to analyze and document this, only to lose my work due to BUEditor (#424400-193: Use BUEditor on drupal.org).

It turns out that this is a new incarnation of #113611: Forum count incorrect when using access control modules, this time for D7, but we end up with the exact same query and the exact same problem, obviously.

#41 in the other thread shows the solution, including comments that explain what is happening. (Unfortunately, the comments didn't make it into the final patch, which makes the code somewhat difficult to grasp.)

The problem is that now we have to work through DBTNG, which won't let us massage the SQL so easily.

I'm tagging this for D7 because AFAIK we don't have any node access module for D8 yet. But it needs to be fixed in D8, too, of course!

webchick’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs tests

Yeah, we fix things in D8 first, then backport to D7. And let's make sure we have a test for this this time so we never break it again.

ifish’s picture

How long this kind of bug fix might take? Few weeks? Month? More than month ? ;o

chx’s picture

ifish, I can fix this bug relatively quick. I have very favorable hourly rates when contributing to open source. Please contact me to discuss further. On the other hand, if you want a free fix then it'll be fixed when someone who knows how to fix it gets the time out of their own lives.

ifish’s picture

If it's a "relatively quick" fix and nothing major, then I guess I could wait.

catch’s picture

@ifish, you are misunderstanding chx.

There are three primary ways that core bugs get worked on:

* A site is affected by the bug and the people working on that site work on a fix.

* A contrib module is affected by the bug and the contrib module author works on a fix.

* A developer is looking over the bug queue for Drupal core because they fix core bugs in their spare time, and decides to pick that particular bug to work on.

Note that in none of these cases, is there a central entity who could give you an answer on when the bug might be fixed, since that is not how Drupal core development works. None of these relate to how difficult the bug is to fix, just on whether anyone is going to work on it at all or when that might happen. So the only way to guarantee that a bug gets worked on within a certain period of time is to pay someone to fix it or try to help with fixing the bug yourself.

chx’s picture

Priority: Major » Normal

In fact, why is this in the major queue? It's a display only, not even every Drupal site bug.

ifish’s picture

Basically these modules (Forum, Taxonomy etc Access) work, but only after you press "Rebuild Permissions" it will mess it all up.

I don't know if it's bad not to rebuild or not but it seems to work even tho this error keeps saying.

ifish’s picture

Ah I found out what was the problem.

I also had "Content access" module installed and when enabling the "Forum Access" module, it asked me to rebuild permissions for "content access" module.

When doing that, it messed all up.. but when changing manually "forum type" content access and unticking view permissions for authenticated/guests it all works and no errors etc.

Just a little tip where the problem might be.

salvis’s picture

@ifish: What you're reporting may work for you, but you're spreading various inaccuracies — reader beware!

Excluding the 'forum topic' content type from Content Access and thus not trying to control the same nodes with two node access modules makes your life easier and removes the need for understanding how they can work together. It has no relevance to the topic of this thread though, because multiple counts can also occur with just CA or just FA alone.

To understand what is happening you need to install Devel Node Access (part of Devel). Whenever DNA shows more than one row granting access to a forum topic node, your counts for that forum will be too high.

Niklas Fiekas’s picture

Status: Active » Closed (duplicate)

Merging into #681760: Try to improve performance and eliminate duplicates caused by node_access table joins. We have there a testcase that shows this issue and a patch to fix it.