• REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Quick stat question

jOOc

Member
Showcase
Hi @Bob

I just tried to do a own sidebar template to use with Widget Framework and I got it to work for everything except categories. Its zero.
upload_2014-12-23_18-23-23.png

If I check on the Showcase page I see this
upload_2014-12-23_18-23-2.png

I use
Code:
$xenCache.showcaseStatsCache.<value>
to get the values.

I check the code very quick (and I'm not good at all) but It looked to me that when you get the value for categories you check if the user has got permissions to see that category when putting it in the stats block.
However this is not done for any other value.
So If there are 100 categories a member will still see the other values (of total in showcase) even when they don't have permissions.
Is this how it should work? I think its best to show all the values on the index page even if member don't have access.

Also I noticed that the images value is only based on Showcase images even if I have a XFMG gallery connected to them.
 
Category count can't be stored in simple cache because it depends on View Permissions for the user. Your count might be 3, but mine (with more access might be 5). The category count is added AFTER the cache is pulled.

for example:
PHP:
        $quikStatsCache = XenForo_Application::getSimpleCacheData('showcaseStatsCache');
        $quikStatsCache['categories'] = count($viewableCategories);

btw, you can't just use this example as there is A LOT more to it (like fetching and preparing the $viewableCategories). Just showing you that the category count for the quickStatsCache array is added seperately as its is a dynamic count based on a per user permissions basis.

XFMG album integration is only for use on the ITEM page for the image gallery. You'd have to add 1000's of lines of code to integrate it elsewhere (it would be a pretty large undertaking actually).
 
btw, yes, that is the way it is designed and is supposed to work (for efficiency and scaling). The stats values such as items, views, images, comments are overall (total system values) as they really are a low priority as far as costing a query for every single page view to get those stats based on viewing permissions (efficiency = o cost for caching vs 100's of 1000's of queries per day on a large scale site).

Categories tho are a top level navigation stat that is more important and there for, I use the actual viewable count as its is already being used as a main part of the controller for every showcase page. It costs nothing, because it is already one of the most vital values needed for a page (for fetching items).

With that said, I've added a 'system_categories' count to the cache that can be used for customization purposes.
PHP:
array(8) {
  ["categories"] => int(16)
  ["system_categories"] => int(16)
  ["items"] => int(37)
  ["views"] => string(4) "7989"
  ["comments"] => string(2) "25"
  ["user_reviews"] => string(1) "7"
  ["images"] => string(2) "93"
  ["lastUpdateDate"] => int(1419359949)
}
 
Last edited:
btw, for anyone looking in on this and being confused, this is new functionality only available in Showcase 2.3.0 (Not released yet). JOOc is one of the SC 2.3.0 beta testers
 
Back
Top