Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[Add-on Bug] RSS2 / ATOM Feeds Pagination
dan39
New
The RSS2 and ATOM extensions appear to, literally, create a separate feed for each subsequent page of a discussion, category, search, and all discussions.
For instance, if you navigate to Page 5 of a particular discussion and then you decide to subscribe to the RSS feed for the discussion, you are actually only subscribing to the "Page 5" feed for that discussion. Which means that you are destined to never see the most recent 4 pages at any given time if you rely on that feed to keep you up to date.
Is there an easy way for the RSS and ATOM extension to default to "Page 1" for every feed?
For instance, if you navigate to Page 5 of a particular discussion and then you decide to subscribe to the RSS feed for the discussion, you are actually only subscribing to the "Page 5" feed for that discussion. Which means that you are destined to never see the most recent 4 pages at any given time if you rely on that feed to keep you up to date.
Is there an easy way for the RSS and ATOM extension to default to "Page 1" for every feed?
0
This discussion has been closed.
Comments
function GetFeedUriForRSS2(&$Configuration, $Parameters) { if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') $Parameters->Remove('DiscussionID'); $Uri = GetRequestUri(); $Uri = explode('?', $Uri); $Uri = $Uri[0]; return $Uri.'?'.$Parameters->GetQueryString(); }
If you're not using mod_rewrite, this is an easy fix, you can do it like this:
function GetFeedUriForRSS2(&$Configuration, $Parameters) { if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') $Parameters->Remove('DiscussionID'); $Parameters->Remove('page'); $Uri = GetRequestUri(); $Uri = explode('?', $Uri); $Uri = $Uri[0]; return $Uri.'?'.$Parameters->GetQueryString(); }
But if you ARE using mod_rewrite, you'll have to parse the $Uri to get rid of the page number... which is more of a pain and my sick head can't deal with figuring that out right now...
I was only able to figure out a really dirty fix by forcing page 1 at all times like this:
<?php function GetFeedUriForRSS2(&$Configuration, $Parameters) { if ($Configuration['URL_BUILDING_METHOD'] == 'mod_rewrite') $Parameters->Remove('DiscussionID'); $Parameters->Remove('page'); $Uri = GetRequestUri(); $Uri = explode('?', $Uri); $Uri = $Uri[0]; return $Uri.'?page=1&'.$Parameters->GetQueryString(); } ?>
My approach seems pretty sloppy, so I'd rather not do it this way if I can help it. Anyone else have any ideas?
(Get some rest, Mark..!)
Wrapping the fetcher for the comments using the code below fixed it for me:
(starting at line 266 in RSS2/default.php, including some unmodified code on the top and bottom for reference)
// Loop through the data $Feed = ""; $Properties = array(); $PageCount = CalculateNumberOfPages($CommentGrid->CommentDataCount, $CommentGrid->Context->Configuration['COMMENTS_PER_PAGE']); $CommentManager = $CommentGrid->Context->ObjectFactory->NewContextObject( $CommentGrid->Context, 'CommentManager'); $CurrentPage = 1; while ($CurrentPage <= $PageCount) { $CommentGrid->CommentData = $CommentManager->GetCommentList( $CommentGrid->Context->Configuration['COMMENTS_PER_PAGE'], $CurrentPage, $CommentGrid->Discussion->DiscussionID); // Old code for fetching a page of comments. Left untouched. $CurrentPage++; } $Feed = ReturnWrappedFeedForRSS2($CommentGrid->Context, $Feed);
----
@Jetthe: When I'm implementing this patch, it only seems to fix the individual "comments" pages. But, I'm still seeing the pagination issue on the other pages (i.e. All Comments pages, Category pages, Search results pages).
If anyone can fix the RSS/ATOM Pagination bug (especially w/ mod_rewrite), please chime in.
EXAMPLES OF THE PROBLEMATIC RSS LINKS:
--------
ALL Discussions - Page 1:
http://lussumo.com/community/?Feed=RSS2
[CORRECT]
ALL Discussions - Page 2+:
http://lussumo.com/community/discussions/2/?Feed=RSS2
[INCORRECT. Should be same Feed URL as Page 1. (Just strip out page number)]
--------
COMMENTS for "The official I hate PCs discussion" - Page 1:
http://lussumo.com/community/discussion/4242/1/the-official-i-hate-pcs-discussion/?Feed=RSS2
[INCORRECT. This only gives you the RSS feed for this page. This feed becomes obsolete once the discussion moves on to the next page.]
COMMENTS for "The official I hate PCs discussion" - Page 2+:
http://lussumo.com/community/discussion/4242/2/the-official-i-hate-pcs-discussion/?Feed=RSS2
[INCORRECT. This only gives you the RSS feed for this page. This feed becomes obsolete once the discussion moves on to the next page.]
--------
"Random" CATEGORY - Page 1:
http://lussumo.com/community/10/?CategoryID=10&Feed=RSS2
[CORRECT]
"Random" CATEGORY - Page 2+:
http://lussumo.com/community/10/2/?CategoryID=10&Feed=RSS2
[INCORRECT. Should be the same Feed URL as Page 1. (Just strip out page number)]
--------
SEARCH RESULTS for "php" - Page 1:
http://lussumo.com/community/search/?PostBackAction=Search&Keywords=php&Type=Topics&btnSubmit=Search&Feed=RSS2
[CORRECT]
SEARCH RESULTS for "php" - Page 2+:
http://lussumo.com/community/search/2/?PostBackAction=Search&Keywords=php&Type=Topics&btnSubmit=Search&Feed=RSS2
[INCORRECT. Should be the same Feed URL as Page 1. (Just strip out page number)]
--------
However... I just found another bug in the RSS feed with friendly URLs. If you subscribe to the RSS feed for this discussion and then click on the Title link (which should take you back to this discussion), it gives you a non-friendly URL that fails.
Mark, any chance you have time to update the RSS and ATOM Add-ons to fix these nasty bugs for everyone?