Jump to content
MediaWiki

Extension talk:SMF Authentication

Add topic
From mediawiki.org

I edited the login hook to work with UserLoadFromSession:

 $wgHooks['UserLoadFromSession'][] = 'AutoAuthenticateSMF';
 /**
 * AutoAuthenticateSMF is the function that creates an automatic login if you are logged in to SMF.
 *
 * @param User $user
 * @return bool
 * @access public
 */
 function AutoAuthenticateSMF($user, &$result) {
 global $smf_user_info;
 //Is user a guest?
 if ($smf_user_info['is_guest'])
 return $user;
 //User isn't a guest
 if (!$smf_user_info['is_guest']) {
 $user->setName($smf_user_info['memberName']);
 $user->setId($user->idForName());
 if ($user->getID() == 0) {
 //User doesn't exist :'(
 $user = new User();
 $user->setName($smf_user_info['memberName']); // Set memberName
 $user->setEmail($smf_user_info['email']); // Set Email Address.
 $user->setRealName($smf_user_info['realName']); // Set Real Name.
 $user->addToDatabase();
 //if user is_admin add him to the SysOp group! Wii ;-)
 if ($smf_user_info['is_admin'])
 $user->addGroup("sysop");
 } else {
 //User exists
 $user->loadFromDatabase();
 }
 // Go ahead and log 'em in
 $user->setToken();
 $user->saveSettings();
 }
 $result = true;
 return $user;
 }

Start a discussion about Extension:SMF Authentication

Talk pages are where people discuss how to make content on MediaWiki the best that it can be. You can use this page to start a discussion with others about how to improve Extension:SMF Authentication.

Start a discussion

AltStyle によって変換されたページ (->オリジナル) /