Is there a way to know the date a topic was last viewed?
I do not believe so
Well, as Kindred uses to say: everything is possible, if you can code it :P
What you already have is smf_log_topics although it doesn't really give you the "when" (although it can give you the "who")
Best possibility (I think) is to stuff a new column in smf_topics (an UNSIGNED INT for some timestamp) and when the table is updated to add a new view
// Add 1 to the number of views of this topic.
if (empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}topics
SET num_views = num_views + 1
WHERE id_topic = {int:current_topic}',
array(
'current_topic' => $topic,
)
);
in Display.php, update that new column with the current time ;)
Thanks for that. :)
I was looking more for some kind of query that I could run on a certain board to see when it's topics were last viewed, just for my own information with the objective being whether or not to get rid of certain threads.
No, that I don't think you can...
Okay then ... will use what you gave me. Thanks again. :)
Marking solved.
Can it not be set something like below to give a timestamp?
// Add time of last view of this topic.
if (empty($_SESSION['last_read_topic']) || $_SESSION['last_read_topic'] != $topic)
{
$smcFunc['db_query']('', '
UPDATE {db_prefix}topics
SET $time = new DateTime
WHERE id_topic = {int:current_topic}',
array(
'current_topic' => $topic,
)
);
Quote from: Steve
... run on a certain board to see when it's topics were last viewed ...
Wouldn't a spidered crawl skew your stats?
Quote from: Shambles on April 21, 2015, 03:34:29 AM
Quote from: Steve
... run on a certain board to see when it's topics were last viewed ...
Wouldn't a spidered crawl skew your stats?
yup...
Good point Shambles. Hadn't thought of that. :)
Nah, it's pretty easy to only update that column if the user is not a guest or even a spider, if recognized as such ;)
There is this mod: Topic View Log (http://www.simplemachines.org/community/index.php?topic=251656.0) , only works for logged in users.
The 'Link to mod' link doesn't lead anywhere. :(
That mod was removed from the mod site.
Quote from: Steve on April 21, 2015, 06:00:22 PM
The 'Link to mod' link doesn't lead anywhere. :(
I have this package and I can send it to you if you need.
you are not allowed to distribute that mod.. It is licensed by SMFSimple.
You can acquire it from the SMFSimple site
http://www.smfsimple.com/index.php?PHPSESSID=90ad698a71c3a090ea93c21e9955dec2&action=downloads
Thanks Kindred! And thanks again to everyone else. :)