I really dont know how to approach this problem, there are solutions out there but they dont use elgg function library, I am pretty sure there are some helper functions to deal with it, overall I think it would be a nice plugin
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Juho Jaakkola@juho.jaakkola
Juho Jaakkola - 0 likes
- Team Webgalli@webgalli
Team Webgalli - 0 likes
- Matt Beckett@Beck24
Matt Beckett - 0 likes
- Olajide@OlaOguns
Olajide - 0 likes
You must log in to post replies.For example the Tidypics plugin has two methods for the image entities: addView() and getViewInfo().
When a user views an image the first one creates an annotation named tp_view for the image. The user who viewed the image is set as the owner of the annotation.
The latter function counts the amount of the tp_view annotations for that particular image.
You can take a closer look of these methods in the file tidypics/classes/TidyPicsImage.php
You could create a plugin that has similar functions. This plugin could add a new item to the blog's entity menu to display the total count of views.
To save the annotations you could for example override the view blog/views/default/object/blog.php and create a new annotation every time when displaying the full_view.
So there's some quick examples that came to my mind...
That's exactly what views counter does - and it does it for blogs: http://community.elgg.org/plugins/872625/1.1/views-counter-18x
@matt Nice plugin! How does it keep count of the views?
it just counts the 'views_counter' annotations associated with each object
@matt I mean how does it know when to create one of those annotations? How does it know that user is viewing an entity?
@juho : extend the entity full view.
ah, yes Juho it's a view extension on full view (though I remember there being a bit of wierd logic there for some reason... it's documented inline I'm pretty sure) that annotates the $vars['entity']
I had some problems with view counter before... but Ill give it a go again