Foren / Cotonti / Extensions / Support / Bug in comments extension

foxhound
#35407 7. September 2012, 15:38

No idea if this is already know, but there is a bug in the comments extension (latest Sienna version 0.9.11).
When you use the pagination to go to page 2 for example but you have the comments at the bottom of the page, not on top, the anchor link is wrong.

In the comments.functions.php the generated anhor link shows /xxxxxxx#comments#comments which is an invalid anchor and so it simply goes to the top of the page instead of the comments area.I fixed that by doing the following:

// A dirty fix for pagination anchors
			$pagenav['main'] = preg_replace('/href="(.+?)"/', 'href="$1#comments"', $pagenav['main']);
			$pagenav['prev'] = preg_replace('/href="(.+?)"/', 'href="$1#comments"', $pagenav['prev']);
			$pagenav['next'] = preg_replace('/href="(.+?)"/', 'href="$1#comments"', $pagenav['next']);
		}

Change to:

// A dirty fix for pagination anchors
            $pagenav['main'] = preg_replace('/href="(.+?)"/', 'href="$1"', $pagenav['main']);
            $pagenav['prev'] = preg_replace('/href="(.+?)"/', 'href="$1"', $pagenav['prev']);
            $pagenav['next'] = preg_replace('/href="(.+?)"/', 'href="$1"', $pagenav['next']);

I removed the "#comments" from the url creation as its already added by the function above this part.
Removing that fixed my comments issue and when I now click the pagination it automatically shows the area of my page where the comments actually are instead of the top.


PS:
I am not sure how you do prefer to recieve bug reports.
I know you have some system where you keep track of things and where people can post what they found but to be honest..........I dont understand so much how that works blush

 

<img src="http://www.armaholic.com/datas/thumbs/green-sea-battalion-uniforms-version-03-preview_4.jpg" alt="green-sea-battalion-uniforms-version-03-" />