i want to save the last visited page of a user,
(get the guid and save it)
should i use elgg _set_plugin_user_setting to save it ? or is there better solution ?
[Edited]
okay, to avoid misunderstanding, i will explain my purpose :
I want to make a feature : Recommendation (show entities list that contains user favourite topic)
So i need data of user 's favourite topic
Simple example: Alex read Pokemon Go article , his favourite topic is Pokemon Go
I need the data of last 10 visited page (the title, url or just tags of the article)
I dont know how to save the data , elgg_set_plugin_user_setting , or annotations or something else (safe ,not use big resource and not make problem in the future)
i'm sorry if i make you confused
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.
I would just set metadata or set an annotation.
But I'm curious how would determine which page is the last one?
Are you gonna do that on every page load?
yes , i'm gonna do that on every page load
save and overwrite so i will get the last visited page
will it be a problem ?
Don't think so, but I think there are more efficient ways of tracking a user.
You could look at something like Mautic, there is an elgg plugin somewhere on github for Mautic.
It gives you a lot more options, is more scalable and you can track every user and what he has done.
I looked at it briefly months back and I liked it a lot.
hmm ithink use Mautic plugin is not necessary for my web, now .
i just want to get the last visited page of my user,
okay i will use annotation (like what you said)
what should the code be like ?
create_annotation($user->guid, 'lastvisitedpage', $_SERVER['REQUEST_URI']);
You will get 'a lot' of annotations if it's storing every pagevisit of every user.
You will get 'a lot' of annotations if it's storing every pagevisit of every user.
what's the worst if i get a lot of annotations ?
I honestly don't know, I'm sure there are better experts to answer your question then I, but you 'could' do something like this, to store only the last 10 annotation and only update the oldest one:
But again, I don't know if this is the most efficient way to do this.
I'm thinking updating isn't a good approach here, it might be better to just delete the oldest one and create a new one, just thinking with you...
that would be this then:
and in the case you only want the latest one (I thought I read somewhere you wanted the last 10 visits, but can't find it anymore)
It would be:
But metadata would be much easier then, and you overwrite it on every visit:
okay it's too complicated for me what if i just use:
advantage: no too many annotation
but i don't know the possible disadvantages . if there is no disadvantages i will use this one.
- Previous
- 1
- 2
- 3
- Next
You must log in to post replies.