Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: Biology Forums - elokuu 23, 2013, 02:18:48 AP

Otsikko: Can SMF recognize if your last session was in a board?
Kirjoitti: Biology Forums - elokuu 23, 2013, 02:18:48 AP
I would like to do the following:

if(users last session was at board)

echo'';

else echo'';

Can that be done using $_SESSION?
Otsikko: Re: Can SMF recognize if your last session was in a board?
Kirjoitti: Arantor - elokuu 23, 2013, 07:20:47 AP
For what purpose exactly? The answer is probably no, but depending *exactly* what you're trying to do it might be doable in other ways.
Otsikko: Re: Can SMF recognize if your last session was in a board?
Kirjoitti: Biology Forums - elokuu 24, 2013, 12:31:20 AP
Thanks for the reply.

What I would like to create is:

IF(previous board session is not the same as current board session)

echo'';

So, let's say your board session is for board 1, if your new board session is from board 2 then execute whatever.

The reason I want this is there is a mod called topic filter. If you specify a specific setting/filter for board 1, it will have that setting for every other board you go to, unless you press reset. I want it to reset automatically once you leave board 1, for example. The code that causes this is (found in load.php):

'filter_topic' => isset($user_settings['filter_topic']) ? unserialize($user_settings['filter_topic']) : (empty($_SESSION['filter_topic']) ? '' : unserialize($_SESSION['filter_topic'])),

If SMF creates board sessions, I can say

IF(previous board session is not the same as current board session)
echo (THAT CODE)
else echo (NOTHING)

A good friend of mine did it for me a while ago very well, but my forum crashed and lost the code months ago.
Otsikko: Re: Can SMF recognize if your last session was in a board?
Kirjoitti: Arantor - elokuu 24, 2013, 09:07:09 AP
It doesn't create board sessions, it has a single session that persists for your visit. Nor does it store the board you're in inside a session. Doing so would be... interesting. And unreliable.