1. 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

Discussion in 'XenForo Development Discussions' started by LPH, Jan 1, 2015.

  1. LPH

    LPH Well-Known Member

    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);
     
  2. LPH

    LPH Well-Known Member

    This should return the album count but it is returning 0.

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

    PHP:
    $media_countsXenForo_Application::getSimpleCacheData('xengalleryStatisticsCache');
    echo 
    '<strong>Media</strong>: ' XenForo_Locale::numberFormat$media_counts['category_count'] ) . '<br />';
     
  3. Chris D

    Chris D XenForo Developer Staff Member

    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 likes this.
  4. LPH

    LPH Well-Known Member

    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?
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    Yeah
     
    LPH likes this.

Share This Page