News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

New Messages since last Login, etc

Started by ChiSamurai, October 29, 2008, 05:28:19 AM

Previous topic - Next topic

ChiSamurai

Hi everyone,

searching for clues or hints to solve my problems for several days now, I decided to bother the SMF community :)

First let me explain the situation. I am working on a kind of CMS, based on SMF. So I integrated several functions from the SSI.php like ssi_login() and ssi_logout() which works fine. But there are some functions I need which are not supported by SSI.php.

First of all, I want to integrate a "There are X new Posts in the Forum"-Message at the index page of the site (after Login off course), but the ssi_recentTopics() only returns the newest X posts. For sure I could compare the post-dates with the user-login-date ([$user_info['last_login']), but I'm sure there is a better way to do.

Second problem is the marking/highlighting of new content on the homepage if a user sets his session-length to "keep logged in" so the session will not be automatically closed. In this case the $user_info['last_login'] will not change on the next visit on the page. There has to be a variable which contains the timestamp of the last action on the forum/page so I can compare it with the timestamp of the new content. But I can't find out where this one is stored.

Hope anyone could help me.

Many thanks,
Samurai

SlammedDime

For your first question, you may want to look at SMF's function for unread topics (action=unread).  You could copy the query, but instead of SELECTing any fields, you could do a SELECT COUNT(*) and just get the number of results that would be returned, should they visit that page.

For your second question, there is no variable that holds such a value.  When they login, or return to the board, you could possibly do a database query on the log_mark_read table in Load.php to see the last message they read on the forum get it's time, and use that as your reference point and store that to the $user_settings or $user_info array.
SlammedDime
Former Lead Customizer
BitBucket Projects
GeekStorage.com Hosting
                      My Mods
SimpleSEF
Ajax Quick Reply
Sitemap
more...
                     

Advertisement: