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

XFMG Total Count on External Page

LPH

Well-known member
#1
How do I get the total media count for a site (for an external page)?

'xengallery_media_count' in XenGallery_Model_User would get for the user but what about the total count?

Also, something like this shows information for the latest user.

PHP:
$total_counts = XenForo_Model::create( 'XenForo_Model_Counters' )->getBoardTotalsCounter();
var_dump($total_counts);
 

LPH

Well-known member
#2
This should return the album count but it is returning 0.

PHP:
$media_counts= XenForo_Application::getSimpleCacheData('xengalleryStatisticsCache');
echo '<strong>Media</strong>: ' . XenForo_Locale::numberFormat( $media_counts['album_count'] ) . '<br />';
Interestingly, category_count returns 1.

PHP:
$media_counts= XenForo_Application::getSimpleCacheData('xengalleryStatisticsCache');
echo '<strong>Media</strong>: ' . XenForo_Locale::numberFormat( $media_counts['category_count'] ) . '<br />';
 

Chris D

XenForo developer
Staff member
#3
The statistics in the cache in XFMG is only updated periodically. Every hour or so. Are you sure the Cron is running? Are you sure it is the album count you need rather than the upload_count?
 

LPH

Well-known member
#4
The statistics in the cache in XFMG is only updated periodically. Every hour or so. Are you sure the Cron is running? Are you sure it is the album count you need rather than the upload_count?
As always Thank you. It makes sense that the cron may not have run yet. It's a local test environment. I did a "Rebuild XenForo Media Gallery User Media Counts" and now the count shows 1 album.

So - the code must be correct for the album count - but I don't see a way to get a total media. It's divided up as upload_media and embed_media. Right?