Thread:Extension talk:Phpbb Single Sign-On/Using Special:UserLogon and Special:UserLogout in liue of skins modifications/reply (3)

Hi all,

Thanks for this modification ! I just used it with phpBB.3.0.10 and MW.1.18.1, had to edit it a little, but now it works just marvelously. I just had two issues with my installation being in French and not in English, then I wanted to do something better in the way of rediection. Everything is described below...

First, for non-English-wikiing users:
 * I had to use the translated version of "UserLogin" and "UserLogout" in for instance $wgSpecialPages['UserLogout'] so that the plugin finds the right classes. For me in French, it gives for instance:

$wgSpecialPages['Connexion'] = 'UserLogin'; $wgSpecialPageGroups['Connexion'] = 'other'; $wgSpecialPages['Deconnexion'] = 'UserLogout'; $wgSpecialPageGroups['Deconnexion'] = 'other';


 * Second, as French uses accents in "Logout" translation : I had to suppress accented letters from the "Logout" page title while keeping them in the display. All this lies in the MessagesFr.php file, giving:

'Userlogout'               => array( 'Deconnexion' ),

Moreover, I wanted to get redirected to the current page whenever I logged in or out, and I had to modify phpbSSO.php, and upc.php in phpBB to get this result. First, I made phpbSSO.php call ucp.php with the extra parameter redirect containing the URL of the current page. Then, I found out that this worked on login, but not on logout. There was a hack described on the net, that I applied and it worked. Below are my edits:

In phpbSSO.php

class UserLogin extends SpecialPage { function __construct { parent::__construct( 'UserLogin' ); }               function execute( $par ) { global $wgRequest, $wgOut, $wgPhpbbSSO_Forum_URL, $wgServer, $wgScriptPath, $wgScriptExtension; $this->setHeaders; # Get request data from, e.g.                       $param = $wgRequest->getText('param'); $returnTo = $wgRequest->getVal( 'returnto' ); # Redirect to phpbb Login page then return to the current page $wgOut->redirect( $wgPhpbbSSO_Forum_URL . "ucp.php?mode=login&redirect=$wgServer$wgScriptPath/index$wgScriptExtension?title=$returnTo" ); }       }        class UserLogout extends SpecialPage { function __construct { parent::__construct( 'UserLogout' ); }               function execute( $par ) { global $wgRequest, $wgOut, $wgPhpbbSSO_Forum_URL, $wgPhpbbSSO, $wgServer, $wgScriptPath, $wgScriptExtension;; $this->setHeaders; # Get request data from, e.g.                       $param = $wgRequest->getText('param'); $returnTo = $wgRequest->getVal( 'returnto' ); # Redirect to phpbb Logout page then return to the current page $wgOut->redirect( $wgPhpbbSSO_Forum_URL . "ucp.php?mode=logout&sid=" . $wgPhpbbSSO->session_id . "&redirect=$wgServer$wgScriptPath/index$wgScriptExtension?title=$returnTo"); }       } In upc.php

#meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); meta_refresh(3, append_sid(request_var('redirect', "{$phpbb_root_path}index.$phpEx"))); $message = $message. '

' . sprintf($user->lang['RETURN_PAGE'], '', ' ');

And now it works like a charm !