Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi.
I'm seeing that the number of topics and posts display as zero.
I disabled the AF module, and the topics and post numbers are displaying correctly. Enabling AF again turns them back to zeros.
Attached is a screenshot for reference.
Thanks, in advance, for any thoughts you might have.
Comment | File | Size | Author |
---|---|---|---|
#20 | advanced_forum-fix_post_count-1739982-20.patch | 1.43 KB | PascalAnimateur |
#16 | forum not count.png | 34.62 KB | kkalaskar |
#16 | forum count.png | 24.58 KB | kkalaskar |
#6 | Screenshot-5.png | 247.3 KB | end user |
forumscreenshot3.jpg | 346.42 KB | play4quarters |
Comments
Comment #1
play4quarters CreditAttribution: play4quarters commentedI was able to get the correct numbers exposed by using the 2.0 recommended release vs. the dev release (testing with the last 2 dev releases without luck.)
Comment #2
troky CreditAttribution: troky commentedIf you want to test, try installing Drupal 7.x-dev and AF 7.x-dev
Comment #3
troky CreditAttribution: troky commentedI believe 7.x-dev will work just fine with upcoming Drupal 7.16.
Comment #5
Frank_F2 CreditAttribution: Frank_F2 commentedUsing Drupal 7.19 and AF 7.x-2.0+26-dev, I got zero's for my topic and posts count. Disabling AF does show the correct numbers. Pls help.
Comment #6
end user CreditAttribution: end user commentedJust installed AF and having same issue with Drupal 7.23+20-dev and AF 7.x-2.3 and Dev. Treid a defualt theme just to make sure but same results. All statistics and permissions have been checked.
Comment #7
end user CreditAttribution: end user commentedHmm so this is not a common issue or are there not enough people using AF to have this problem?
Comment #8
nithyakarthigan CreditAttribution: nithyakarthigan commentedEven I have the same problem. anyone find the solution. plz share...
Comment #9
Angrim CreditAttribution: Angrim commentedAfter the update from today , i have the same problem. The number of posts and topics are not counted and displayed.
Anyone have an idea to resolve the problem.
Comment #10
becometa CreditAttribution: becometa commentedsame here..
Comment #11
LemonHardos CreditAttribution: LemonHardos commentedsame here...
With both stable and dev releases (2.4 & 2.x).
Must be related with permissions set from roles because it works on public forums.Investigating...
-Topic count to zero only when viewing the forum from within it's container. So if i click/show only the container i see it's forums with their correct topics count.
-Turned a private (role based perms) to public and still same bug : Topic count zero on main forum path /drupal/forum/. So it seems not permissions related. Now i will compare the "working containers" with containers with false zero topics count.Finaly topic count was back after few minutes (cron ?), investigating...Ok i finally did a cron + clear cache and everything is back to normal... i can't explain why, maybe because i installed Dev release then forgot to clear cache + cron.
Comment #12
Angrim CreditAttribution: Angrim commentedIt must be definitely a role or permission problem.
The forum which has permissions for guest will be displayed correct. Only the forums for the members of the side has the problem.
A cron and clear cache resolve the problem one time.
I use
Drupal 7.33
Forum 7.33
Advanced Forum 7.x-2.4
Advanced Forum More Styles 7.x-2.0-alpha1
Forum Access 7.x-1.2+6-dev
Comment #13
LemonHardos CreditAttribution: LemonHardos commented@#12
Oh just checked and you are right, topics count are back to zero :/
And right, only privates forums are targeted by the bug...
Comment #14
MichelleIf it's only private forums, could you test to see if the bug occurs with Forum Access enabled and Advanced Forum disabled? That will isolate whether the problem is in Forum Access alone or if there is some conflict between AF and FA.
Comment #15
Angrim CreditAttribution: Angrim commentedHello Michelle,
Only Private Forums are affected.
I have tested it with Advanced Forums deactivated and Forum access activated.
Now will be the number of posts and topics displayed correctly.
Thank you for your help.
Best regards
Angrim
Comment #16
kkalaskar CreditAttribution: kkalaskar commentedHello to all,
Solution is here
I faced same problem with my forum project. I installed modules -
The 0 count problem occurs because of $count array remains null into the advanced_forum/includes/core-overrides.inc file on line no. 145
This code rendered query like this -
SELECT f.tid AS tid, COUNT(DISTINCT(f.nid)) AS topic_count, SUM(f.comment_count) AS comment_count FROM {node} n INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {forum_index} f ON n.nid = f.nid WHERE (type IN (:db_condition_placeholder_0)) AND (status = :db_condition_placeholder_1) AND ( EXISTS (SELECT na.nid AS nid FROM {node_access} na WHERE (( (na.gid = :db_condition_placeholder_2) AND (na.realm = :db_condition_placeholder_3) )OR( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) )OR( (na.gid = :db_condition_placeholder_6) AND (na.realm = :db_condition_placeholder_7) )OR( (na.gid = :db_condition_placeholder_8) AND (na.realm = :db_condition_placeholder_9) ))AND (na.grant_view >= :db_condition_placeholder_10) AND (n.nid = na.nid) )) GROUP BY tid
So i did small change in it with the reference of Drupal`s core forum module. I changed place of $count.
like -
Now its showing proper count on my forum but I am looking for proper solution.
Comment #17
Dandily CreditAttribution: Dandily commentedkkalaskar, thank you a lot, it's work for me!
Comment #18
wla_g CreditAttribution: wla_g commentedFor me it worked as well. Should be committed.
Comment #19
MichelleIf someone would turn this into a patch and get it reviewed, that would help a lot. As much as I want to work on AF, I have too much on my plate presently so making it easier for me would make it more likely for me to be able to commit it. :)
Comment #20
PascalAnimateur CreditAttribution: PascalAnimateur commentedHere's a patch on 2.x-dev with the modifications from #16 by @kkalaskar
Comment #21
MichelleAwesome, thanks! I'll be at DrupalCorn this weekend and am hoping to get in a little contrib time while I'm there. Will have a look.
Comment #23
podarok#20 pushed to dev
Thanks
Comment #24
FrancoisL CreditAttribution: FrancoisL commentedHello this solved a part of my problems. indeed forum Home Page display now Topic number, Posts and Last post.
I still have a problem when I'm in a forum. I have the topic list but nothing in Replies, Views and last post. I think this is related to "Advanced Forum topic list" Views. When I activate "more Style" Module I see stats in for example "Active topics" but always not in my topic list in all forums.
Is someone can help please?
Thanks in advance.
Comment #26
luison CreditAttribution: luison commented#20 patch
works perfectly for me.works but with some changes... see #27Thanks
Comment #27
luison CreditAttribution: luison commentedJust one thing.
In my case, I had to delete ->addTag('node_access') lines.
The one from the patch and the other:
$topics = $query
->fields('ncs', array('last_comment_timestamp', 'last_comment_uid'))
->fields('n', array('nid', 'title', 'type'))
->condition('n.status', 1)
->orderBy('last_comment_timestamp', 'DESC')
->range(0, $post_count)
//->addTag('node_access')
->execute();
If not, the forum shows 0 topics and 0 posts even when there are posts and topics.
Comment #28
kalaiselvann CreditAttribution: kalaiselvann as a volunteer and commentedLuison
I changed above you mentioned #27 and below versions but still showing topics and posts 0.
Drupal 7.43
Advanced Forum 7.x-2.6
Advanced Forum More Styles 7.x-2.0-alpha1
Forum Access 7.x-1.2-dev
Comment #29
kalaiselvann CreditAttribution: kalaiselvann as a volunteer and commentedI found that the issue is with the feautres module.
Even after uninstalling the feature module the data is still exist in the database. You should delete the database entries manually to solve the issue
Comment #30
grahammiranda13 CreditAttribution: grahammiranda13 commentedOMG #27 luison solved my problem!!!!
THANK YOU SO SO SO MUCH!
Comment #31
grahammiranda13 CreditAttribution: grahammiranda13 commenteddo //->addTag('node_access') to all of them on that file!
Comment #32
AnybodySee follow-up: #2881223: Conditionally bypass node_access when displaying Topic/Post counts and Last Post which replaces #27 with a proper setting. Please review.