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.
Aha, I think I got you wrong, Do you want to log what users visited your website?
I thought you wanted to log every lastpage 'a user' visited
plugin settings aren't stored as arrays. You could do that and store it as a serialized array if you want to pretend we're in wordpress ;)
Annotations would probably be the best bet here - listen to Dries, just make sure you're clearing out the old ones because that could bloat db real fast otherwise (trust me, I've done it).
Also, instead of $_SERVER['REQUEST_URI'] you should probably use
okay, to avoid misunderstanding, i will explain my purpose :
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
@matt becket , so the conclusion the annotations is the best way ? okay i will try it
@dries : i've re-explained my purpose above , i hope you understand now and can help me :)
I think I would implement this by creating a relationship between the user and the piece of content:
This way I could always get the latest data.
Consider this:
However, if done with relationships, it would be possible to query the exact blog post in case you later need the title:
@juho i think it will work, thanks
but how to get last 10 visited page ? can i put 'limit'=>10 , 'order_by' => time_created dsc ?
Yep relationships will work too, just make sure you manage them in a spot where it's clearly the page for the content. Eg. blog/all will load 10 blogs and output them with elgg_view_entity(), you don't want to log them all as read.
Originally we assumed you needed to log *every* url visited, in which case relationships wouldn't work, but for content full-views only, that is the best way.
Okay i want to ask (maybe) once again ,
what should i choose ?
which one that use less resource (memory, CPU usage, etc) ?
note: i will save data every user open full-view content , example: Alex read Pokemon Go article,
i'm sorry i'm not expert about database, i just dont want get problem in the future coz i think i will not be able to solve about database problem.
So help me to choose ,
From what you have described, go with the relationships as per Juho's suggestion
- Previous
- 1
- 2
- 3
- Next
You must log in to post replies.