FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » Added external_fud_session_status($str) to forum_login.php
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Added external_fud_session_status($str) to forum_login.php [message #34996] Thu, 30 November 2006 22:15 Go to next message
rcwjenks is currently offline  rcwjenks   United States
Messages: 3
Registered: November 2006
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I've recently installed FUD and integrated it into my existing PHP based site. I use my site's login to login to both the forum and my site. I'm using the scripts/forum_login.php to accomplish this. I found (at least) two difficiencies in this approach:

1) If the user logged in to my site and did not navigate to the forums, the user would not be considered "online" (to FUD) after a short period of time. I wanted to use FUD's online list for both.
2) If another user went to the really cool "show what people are doing" page, it wouldn't show what they were doing outside the forums.

To fix this, I added the following function to forum_login.php and I call this on every page on my site. I pass in a str values indicating where they are. It seems to work fine.

Is this code the correct way to do this?

If this would be useful to other, you're welcome to include this code in the product without crediting me. I release all rights.

function external_fud_session_status($str=null)
{
        __fud_login_common(1);
        $ses_id = $_COOKIE[$GLOBALS['COOKIE_NAME']];
        if (!empty($ses_id)) {
                $sys_id = __ses_make_sysid(($GLOBALS['FUD_OPT_2'] & 256), ($GLOBALS['FUD_OPT_3'] & 16));
                q('UPDATE fud26_ses SET sys_id=\''.$sys_id.'\', time_sec='.__request_timestamp__.', action='.($str ? _esc($str) : 'NULL').' WHERE ses_id=\''.$ses_id.'\'');
        }
}
Re: Added external_fud_session_status($str) to forum_login.php [message #35011 is a reply to message #34996] Fri, 01 December 2006 10:32 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
That's the correct way of doing it, although need to be careful with what you put into "action" to make sure it can be displayed properly on the action list.

FUDforum Core Developer
Re: Added external_fud_session_status($str) to forum_login.php [message #161171 is a reply to message #35011] Sat, 21 November 2009 07:35 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3632
Registered: December 2004
Karma: 17
Senior Member
Administrator
Core Developer
add to buddy list
ignore all messages by this user
Code committed as per https://sourceforge.net/apps/trac/fudforum/changeset/4870
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Embedded Tinypic Uploader
Next Topic: Wikipedia plugin is not working for Russians
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Dec 18 07:30:57 EST 2017

Total time taken to generate the page: 0.00698 seconds