On 8/31/07, Jim Hu jimhu@tamu.edu wrote:
From what I can tell, $user->isLoggedIn() tells whether a user object is an anonymous one or one with an id in the user table. Is there a function that actually can tell if a user is logged in? I'm not trying to display this in the wiki, I'm trying to integrate logging into the wiki into the login system of a blogging package I have. I realize that most authentication packages do it the other way, but I'd like to try making the blog treat users as logged in if they are logged into the wiki.
I'm guessing that there must be session info that I can use somewhere. My thought is to have the blog send a query on a private port or via the shell to something that responds if the username matches someone who is logged in. My first attempt:
<?php require_once("./includes/WebStart.php" ); require_once("./includes/Wiki.php" ); $mediaWiki = new MediaWiki(); $wikiUser = User::newFromName($_REQUEST['user']); if($wikiUser->isLoggedIn()){ echo "y"; } else{ echo "n"; } ?>
returns Y whether the user is logged in or not, for the reason described above.
Jim
===================================== Jim Hu Associate Professor Dept. of Biochemistry and Biophysics 2128 TAMU Texas A&M Univ. College Station, TX 77843-2128 979-862-4054
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
All users regardless of whether they are logged in or not have a user ID (anonymous == user id 0) so the only check that needs to be made is whether the user id is a positive integer.