Hey Michelle, or anyone else that might be able to assist.
I was wondering if you could help a brother out :)
I'm using the latest dev version of Advanced Forum along with Drupal Core 7.15.
When I'm testing message threads. The "reply-to" number seems to get out of synch.
The indentions are correct, showing posts below the comment that I'm replying to, but the number for the reply to link points to an incorrect post item.
I've attached a screenshot to give you a feel for what I'm experiencing.
I'm hoping maybe u have run into this before and might have a quick tip for me?
Thanks so much for your time and thoughts.
Best!
Glenn
Comment | File | Size | Author |
---|---|---|---|
#55 | wrong_post_position-1724080-55.patch | 2.2 KB | rDeeb |
#48 | advanced_forum-wrong-display-in-reply-to-1724048-48.patch | 1.87 KB | gifad |
#41 | 1724080-41.patch | 1.59 KB | quotesBro |
#7 | af7_1724080_2.patch | 2.1 KB | troky |
#5 | af7_1724080_1.patch | 1.2 KB | troky |
Comments
Comment #1
MichelleTroky is maintaining this branch and I'm not using the module at the moment. This issue sounds really familiar, though, so I suggest searching the issue queue.
Michelle
Comment #2
play4quarters CreditAttribution: play4quarters commentedThanks Michelle.
Yes, I did search the issue queue and did indeed find something similar, but it was related to Drupal 6, and made references to flat list display, that I don't see as an option in Drupal 7.
Anyone else have any thoughts?
Thanks again.
Comment #3
troky CreditAttribution: troky commentedDefinitely a bug.
Comment #4
play4quarters CreditAttribution: play4quarters commentedThanks Troky.
I appreciate you updating to a bug report, and appreciate any help you can provide in remedy.
I also appreciate the efforts on this module. Thank you!
Comment #5
troky CreditAttribution: troky commentedThis patch should fix the problem. Please try it and report back.
Comment #6
play4quarters CreditAttribution: play4quarters commentedThanks for the fast response on this. Very appreciated.
I've implemented the patch and tested. It does seem to have corrected the numbering issue I was encountering.
A new issue has popped up, which I'd not seen before installing the patch:
When I click on a forum comment reply button, I'm getting this error the first time I try to do so in a new browser session:
Notice: Undefined variable: node in advanced_forum_post_position() (line 1302 of /home/boundles/public_html/sites/all/modules/advanced_forum/advanced_forum.module).
Notice: Trying to get property of non-object in advanced_forum_post_position() (line 1302 of /home/boundles/public_html/sites/all/modules/advanced_forum/advanced_forum.module).
If there's anything more I should provide for troubleshooting purposes, please let me know.
Thank you again!
Comment #7
troky CreditAttribution: troky commentedTry new patch.
(roll back old patch before applying new one)
Comment #8
play4quarters CreditAttribution: play4quarters commentedHi Troky.
What I'm seeing now is that the reply to links are not displaying, and I receive the following error when replying to a post:
Notice: Trying to get property of non-object in advanced_forum_post_position() (line 1298 of /home/boundles/public_html/sites/all/modules/advanced_forum/advanced_forum.module).
Notice: Trying to get property of non-object in advanced_forum_post_position() (line 1299 of /home/boundles/public_html/sites/all/modules/advanced_forum/advanced_forum.module).
Notice: Trying to get property of non-object in advanced_forum_post_position() (line 1305 of /home/boundles/public_html/sites/all/modules/advanced_forum/advanced_forum.module).
Thanks again.
Comment #9
troky CreditAttribution: troky commentedAre you sure you patched advanced_forum_preprocess_comment.inc, too?
Check line 89... it should be:
Comment #10
play4quarters CreditAttribution: play4quarters commentedMy Sincere Apologies.
You are absolutely right.
The patch did change both files, but I had only copied the one file back to the server.
Everything is now working as expected, and I totally love the way the navigation works. This module is terrific.
Thank you so much for your help.
Comment #11
troky CreditAttribution: troky commentedThanks for testing.
Committed to 7.x-2.x-dev.
Comment #13
quotesBro CreditAttribution: quotesBro commentedThere's mistake in #7 patch.
should be
Comment #14
quotesBro CreditAttribution: quotesBro commentedMarked #2092575: Incorrect reply numbers in comments as duplicate of this issue.
Comment #15
podarok#13 commited
Thanks!
Comment #17
wimberb CreditAttribution: wimberb commentedI installed the latest dev version today (2014-Jun-21) and now all my "Reply to" numbering is broken. It was working fine before the latest dev.
Comment #18
wimberb CreditAttribution: wimberb commentedI looked at the patch from #13 where the line $post_id = $comment->pid; was changed to $post_id = $comment->cid;. I edited advanced_forum.module and changed it back to pid and the numbering is working correctly again. So for me this patch breaks Advanced Forum reply-to numbering.
Comment #19
wimberb CreditAttribution: wimberb commentedLooking further... The above Reply to numbering was on my Forum. Changing to pid corrects the Forum. But after looking at Node Comments I noticed that neither cid nor pid works correctly after updating to the latest dev version.
Comment #20
quotesBro CreditAttribution: quotesBro commentedI am sorry! I can confirm #18 - my patch from #13 breaks reply-to numbering.
It seems like comment order on forum differs from regular node comments. Quick workaround (needs prior testing, review and work of somebody who understand this difference):
Comment #21
podarokadded this thread to release known issues
https://www.drupal.org/node/2290369
Please, feel free to upload patch against latest dev to fix this issue asap.
Thanks in advance
Comment #22
podarokComment #25
podarokComment #26
podarokCan anyone install #20 patch and test it?
If it is working, I`ll commit/tag quickfix release
Comment #27
ExTexan CreditAttribution: ExTexan commentedIt seems like the check for node type being "forum" should really be checking for all node types designated for Adv Forum. In my case, that would be "forum", "poll", and "advpoll".
Comment #28
akinliat CreditAttribution: akinliat commentedThe issue here isn't the math, it's the logic in the code that's generating the link text. There are two nodes you're worried about here -- parent and child. With the exception of the link, all the data that's being used is from the child node. Here's the problem, just in these two lines in advanced_forum_preprocess_comment.inc (line 94-96, I think, but I've been messing with the file and not neatly):
You're checking that the parent id exists, and then find the position of the child node -- the one that you're currently rendering -- when what you want is the position of the parent node. Since the pagination is tied to the $post_position the links will also break if the parent post is on another page.
A quick solution, though not terribly efficient, would be the following:
I've checked this and it works, at least for flat or threaded ascending sorts. Descending sorts are a disaster, but that's to be expected, I suppose, as the page/position calculations assume ascending sorts. I've added a patch, if someone wants to give it a try.
Comment #29
akinliat CreditAttribution: akinliat commentedThis patches the logic error in advanced_forum_preprocess_comment.inc where the child node was being used in place of the parent node for position calculations.
Comment #30
podarokComment #32
akinliat CreditAttribution: akinliat commentedOops. No more patches after midnight for me. Let's see if this one flies.
Comment #33
quotesBro CreditAttribution: quotesBro commentedComment #34
quotesBro CreditAttribution: quotesBro commentedcomment_load() in #32 can affect perfomance (anyway, #32 works)
here is improved version of #20. As mentioned by @ExTexan in #27, we need to check for all node types with the forum style applied.
This patch works for me, please try it.
Comment #35
akinliat CreditAttribution: akinliat commentedI thought about that, but the only way I can see around it is to rewrite advanced_forum_post_position to use $comment->id instead of $comment. I didn't want to do that without knowing what else depended on that function. As it happens, this is the only call to advanced_forum_post_position in the module.
That said, rewriting advanced_forum_post_position would remove the check for deleted or otherwise invalid comments.
Comment #36
milovan CreditAttribution: milovan commentedPatch 1724080-34.patch from #34 works for me.
Thanks for the patch!
Comment #37
MichelleThanks for the patch and the comments. I'm just getting back into AF again and will try to have a look soon.
Comment #38
toddwoof CreditAttribution: toddwoof commentedPatch in #34 works for me as well.
Comment #39
MichelleSorry for the long delay. Life's been kinda crazy this last month and I didn't get to Drupally things like I thought I would. I'm off for a week of training at my new job but will try to set aside time for contrib as soon as I can.
Comment #40
wimberb CreditAttribution: wimberb commentedI applied the patch from #34 and it fixed everything. Well almost everything. The only problem now is that when you click on a node comment (reply to #) link they all work correctly except for (reply to #1). When I select (reply to #1) the screen refreshes and all of the comment numbering is all messed up. For instance the first comment is numbered -49. Then going down the list they are -48, -47, etc. Clicking on any of the other links besides (reply to #1) sets everything back as it should be.
Here is an example node comment
On Forum posts there is no (reply to #1). They start out at (reply to #2). So I'd give #34 a "close but no cigar" rating. If I knew anything about programming I'd take a run at trying to fix it.
Comment #41
quotesBro CreditAttribution: quotesBro commentedBill, thanks for testing!
Please try that (for me it fixed the problem that you described):
includes/advanced_forum_preprocess_comment.inc
Comment #42
wimberb CreditAttribution: wimberb commented@dberror that seems to have fixed it. Thanks!
Comment #44
podarok#41 commited. Thanks!
Comment #46
ExTexan CreditAttribution: ExTexan commentedSorry to come (back) so late to this thread. For some strange reason, that patch doesn't work in my case. I had to change this:
...back to "+2".
But there's also another related issue... If you are styling all comments like forum posts, the reply-to post number is off by one. So, I had to add an "else" to the above "if" to add 1. The permanent fix should really check the setting for "style all comments like forum posts", but I was trying to get this fixed quickly, so I did the simple "else" patch.
Comment #47
quotesBro CreditAttribution: quotesBro commentedComment #48
gifad CreditAttribution: gifad commentedHi all,
The first cause of this simple issue not succeeding is that the function
advanced_forum_post_position
has been patched to take a comment object as the second argument, rather than the original comment id - and it uses $comment->cid, so it returns the position of the comment, not his parent...So, I restored the arg list, and call it with $comment->pid.
Also, add 1 to the return value, as comment with index 0 should be displayed '#1'.
Comment #49
ExTexan CreditAttribution: ExTexan commentedThe reason that it has to add 2 for forum posts and add 1 for posts styled like forum posts is because...
I've found that the same situation applies to the part of the above patch that is for advanced_forum_preprocess_comment.inc where it calculates the page number for the link back to the "replied-to" post. That calculation needs to subtract 2 for forum posts, and subtract 1 for non-forum posts styled as forum posts.
Edit: @gifad, your reply was posted while I was writing mine. I'm not sure how your changes will affect/solve the situations I wrote about just now. Could you revisit the patch based on my observations and see if there's still an issue? My feeling is that it will still need to handle the forum posts vs. non-forum posts styled as forum posts situation.
Comment #50
ExTexan CreditAttribution: ExTexan commentedI just updated to 7.x-2.5. I realize that the release date is right around the same time as the last few posts above, so I'm not surprised that some of the latest "fixes" didn't make it into that version. Since I had to redo the fixes just yesterday (and they are fresh in my mind), I thought I'd post my code here, in case it helps.
I have three content types that are tagged as forum content, and 2 or 3 others that are not, but whose comments are styled like forum comments. The following code is what's working for me in both cases:
This is at line 1372 of advanced_forum.module. If I let it use cid, the "Reply to #x" values are all wrong. For example, if #4 replies to #2, it will show "Reply to #4".
At line 1414 (may actually be line 1413 because of my extra commented-out line above) of advanced_forum.module, I have this...
The reason for that is explained in my post #49 above.
And at line 102 of advanced_forum_preprocess_comment.inc, I now have this...
Again, same reason as above. Without this change, the "page=x" value (in the "Reply to #x" link) is wrong for posts that are at the top of the current page, and/or the bottom of the previous page.
Comment #51
podarokI guess it still needs work?
Comment #52
ExTexan CreditAttribution: ExTexan commentedWell, I can't explain why using cid is working(?) for others, because using pid is the only thing that works for me.
But the other two patches are because, for forum nodes, the node itself is counted as post #1, but for non-forum nodes it isn't. To say it another way, the first comment in forum threads is #2 - the first comment in non-forum threads is #1.
I think if you use the code from #50, it should work. Besides, it will certainly be "reviewed and tested by the community" here.
Comment #53
gifad CreditAttribution: gifad commentedinstead of fighting about choosing
$comment->cid
or$comment->pid
, I'd suggest in #48 to revert the function signature to its original :function advanced_forum_post_position($node, $post_id)
and let the caller choose which post he/she refers to...
Comment #54
ExTexan CreditAttribution: ExTexan commented@gifad,
Perhaps the reason it didn't work when I tried it might be related to this part of your reply... "let the caller choose which post s/he refers to". I suppose that would necessitate changes to other parts of advanced_forum not addressed by your patch. I don't know, I'm just speculating here.
But aside from that, regarding this from your #48 post... "Also, add 1 to the return value, as comment with index 0 should be displayed '#1'." -- I think that would need the "add 1 or 2" logic I described above - to handle the forum-thread / non-forum-thread situations - because comment index 0 will be #2 or #1 (respectively) in those two cases.
Comment #55
rDeeb CreditAttribution: rDeeb at Rootstack commentedI implemented this solution which inside the function verifies if it is a threaded reply and uses the comment parent to calculate the reply to position, or if on flat view uses the default logic.
Comment #56
c470ip CreditAttribution: c470ip commentedRecently I've just noticed that quoted post number is always leading to the previous post, for example in post #6 it will say 'In reply to post #5' and so on. The link to the quoted post is correct though. Has anyone experienced this very behaviour?
I am using version 7.x-2.5.
Comment #57
ExTexan CreditAttribution: ExTexan commented@c470ip, yes, that's what this thread is trying to fix, so you've posted in the right place.
@rDeeb, I've never had to add 2 or 3... only 1 or 2 (depending).
The code I posted in #50 (sorry it's not in the form of a patch), has been working for me for several months in a site with a mix of forum comments, and non-forum comments styled like forum comments. It seems pretty straight forward to me. How about we put that in the dev version and get to the "testing by community" stage?
Comment #58
c470ip CreditAttribution: c470ip commented@ExTexan Just tried your solution. Changed advanced_forum.module and advanced_forum_preprocess_comment.inc according to #50.
Got the following errors:
Notice: Undefined variable: advanced_forum_styled_node_types in function _advanced_forum_preprocess_comment() (line 101 in file /home/***/www/sites/all/modules/advanced_forum/includes/advanced_forum_preprocess_comment.inc).
and
Warning: in_array() expects parameter 2 to be array, null given in function _advanced_forum_preprocess_comment() (line 101 in file /home/***/www/sites/all/modules/advanced_forum/includes/advanced_forum_preprocess_comment.inc).
several times per each opened forum threads (possibly the same times as quote referrers were met).
I just reverted advanced_forum_preprocess_comment.inc to its original version, now the errors are gone, quoted post numbers still remaining correct.
Comment #59
ExTexan CreditAttribution: ExTexan commentedOops. I guess I should have included the line of code before that too. I had already applied a patch from earlier in this thread - one that determines if the node type is styled as a forum post. It didn't work completely (as per my post #50), but I kept the line that determines styled node types. Sorry for the confusion.
Here's the more complete code, with my rather verbose comments.
In advanced_forum.module, around line 1405...
In advanced_forum_preprocess_comment.inc, just after "if ($post_position > 0) {" - (line 98?) - and before "// Assemble the link."...
Comment #60
c470ip CreditAttribution: c470ip commentedAs the Advanced forum module has renewed to 2.6, indicated post positions became wrong again.
@ExTexan I just tried the patch in #59, unfortunately what it does is just change quoted link from [previous_post] to [current_post], that means quoted posts now always point to themselves.
#50 still works fine for me (only changes in module, not the .inc file).
Thank you for your work.
Comment #61
ExTexan CreditAttribution: ExTexan commented@c470ip,
That's really strange, because I have carried that code through three or four versions of AF now. My site has more than 75,000 posts on 3500 topics, with a mix of posts that are actually on AF content types and ones that are "styled like forum posts". All post numbers (and underlying links) are working perfectly.
I just looked back at #50. Perhaps the first code block there takes care of the "parent" vs. "current" issue you mentioned.
[Sorry the code in my comments ended up in different posts.]