Views Counter v1.0

Release Notes

Initial Release

  • perfect, its really good

  • @sachin - please provide more information when reporting bugs

    - what were you viewing when this occurred?
    - what version of elgg are you using?

    - is this system wide? user-specific?

    - how can I replicate the error?

  • If a robot/spider can view the page it will be included in the view counts as a not-logged-in user unless you've done something to allow them to index as an authenticated user - in which case it will show up as that user.

    I agree that last visit makes more sense to me, but that's a design choice and not a bug, I was paid to recreate the functionality of the 1.7 plugin - and that plugin lists first visit.

  • I'm not sure what you mean about bug1 - can you elaborate?

    bug2 -

    included automatically for any entities, based on subtypes, that follow some specific elgg patterns that comes from the elgg_view_entity() function

    The new entity must exist in the database first of all, just enabling a plugin isn't enough.  Secondly, the entity must be displayed using the elgg view conventions of the core entities - many third party entities are not.

  • Hello Matt, 

    I've got the same error, mentioned by Sachin, I copy bellow.

    Maybe it is a problem of my installation?

    - Elgg version : Release - 1.8.4, Version - 2012041801

    - Running on WAMP

    - while click on the button : Views counter admin page

    - logged in as Administrator

    http://localhost/elgg/views_counter/list_entities/user  

    Fatal Error.

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) LEFT JOIN elgg_metastrings ms ON ((a.entity_guid=e.guid)AND(a.name_id=)AND(' at line 1

    QUERY: SELECT DISTINCT e.*, sum(ms.string) as views_counter FROM elgg_entities e LEFT JOIN elgg_annotations a ON ((a.entity_guid=e.guid)AND(a.name_id=)) LEFT JOIN elgg_metastrings ms ON ((a.entity_guid=e.guid)AND(a.name_id=)AND(a.value_id=ms.id)) WHERE ((e.type = 'user')) AND (e.site_guid IN (1)) AND ( (1 = 1) and e.enabled='yes') GROUP BY e.guid ORDER BY views_counter desc, e.time_created desc LIMIT 0, 40


  • Hmm, I still can't replicate it, but I have a theory... stay tuned.

  • OK I've found it, all you have to do is view any entity that's being tracked.  This error occurs if you enable the plugin for the first time and go straight to the admin page without any views being counted.  I'll fix it in a subsequent release.

  • I would like to show the 10 most viewed blogs on the home page, or in the side bar. does anyone know the correct code to do this?

  • $options = array(

       'types' => array('object'),

       'subtypes' => array('blog')

       'limit' => 10

    );

    list_entities_by_most_viewed($options);

  • thank you for the help Matt!I will try that out tonight!

Matt Beckett

I'm a self-employed web developer, family man, nerd, scuba diver. Manager/maintainer of this elgg community site, and core Elgg development team member.

Project Info

Stats

  • Category: Site admin
  • License: GNU General Public License (GPL) version 2
  • Updated: 2015-11-7
  • Downloads: 4164
  • Recommendations: 27

Other Projects

View Matt Beckett's plugins