making bbPress (and WordPress) work better!

bug in paged comments plugin when using other queries, with solution

I found a minor bug in the paged comments plugin (last updated April 2006) when you are trying to use other queries on the URL.

ie. example.com/2006/07/25/text-example/comment-page-3/?test=1
will cause a 404, at least on my blogs

I traced it back to the function paged_comments_fancy_url() which doesn’t expect anything else on the URI except an ending slash or not.

To fix this just take the first line of that function and change it from

$req = rtrim($_SERVER['REQUEST_URI'], '/');

to

$req = rtrim(str_replace('?'.$_SERVER['QUERY_STRING'],'',$_SERVER['REQUEST_URI']), '/');

This is a quick fix solution and I am not certain what the effects might be since the function resets the request url back to $req later on. Other plugins might look direct at the url for the query string instead of at $_SERVER[‘QUERY_STRING’]

Not quite sure why he does it that way but my fix works so there you go.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s