1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed Pagination breaks for admins if lots of deleted/unapproved resources

Discussion in 'Resource Manager Resolved Bugs' started by Jon W, Mar 26, 2013.

  1. Jon W

    Jon W Well-Known Member

    Sorry to drop my first reported bug on release date (instead of when you had time to fix it before release date)...

    When viewing all resources (i.e., latest, most downloaded, etc.), the total number of resources is calculated from the cached category counts, which do not include deleted/unapproved resources:
    $totalResources 0;
    foreach (
    $categories AS $category)
    $totalResources += $category['resource_count'];
    As such, if you have lots of deleted/unapproved resources (or even if you have 1 deleted/unapproved resource in a category with 21 resources), you may not be able to view all the resources without looking through all categories.

    To make matters worse, unless every single resource has been deleted/unapproved (unlikely), you can't even try to access the hidden pages by adding ?page=2 etc., because the URL is canonicalised:
    so you end up being bounced back to what it thinks is the last page.
  2. Mike

    Mike XenForo Developer Staff Member

    I've fixed this now, though there's still an edge case I'm leaving for performance reasons. I'm using the category count unless you can see all deleted or moderated resources. The edge case is if you have a resource awaiting approval right now but you can only see your own. The count won't be bumped for that so it may be slightly off, but I think that's rare enough that it's worth saving the query to just run for moderators.
    Jon W likes this.

Share This Page