[Mediawiki-l] $user->isLoggedIn()

Jim Hu jimhu at tamu.edu
Fri Aug 31 18:13:54 UTC 2007


 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




More information about the MediaWiki-l mailing list