Talk and Questions about Auth-SMF

Leave latest contribution at the top please!

To everyone who has problems with SMF redirecting to PmWiki on login/logoff, here's how I solved it.

Fixing logoff

  1. Comment/remove this line from auth-smf.php: $_SESSION['logout_url'] = $ScriptUrl."?action=logout";
  2. Don't use (:smf-logout:), instead use something like this: [[{*$FullName}?action=logout | Logout]]

Fixing login

  1. In SMF theme's index.template.php, add these lines in function template_main_above() like so:
// The main sub template above the content.
function template_main_above()

  // Begin of PmWiki login redirect fix
  if (isset($_SESSION['login_url'])) {
    if (!isset($_GET['action'])) {
    elseif ($_GET['action'] != 'login') {
  // End of fix

Just a quick note, I can't get this to work and I'm going to write it off to it's use of Session state. I actually just wanted to reuse the credentials store, because I am using two different subdomains for SMF and PmWiki ( and

SMF works just fine with the changes, but clicking on 'Edit' in PmWiki just refreshes the page, clearly I don't have permissions anymore.

I'm not stressed about it, but if you're ever updating the plugin it's a 'bug' that could be addressed. I say 'bug' because it really is an unusual scenario. Anyhow, thanks! Jeff W?


I installed the software as per your instructions above and apart from making the same error as Matthias it now all works almost perfectly. The only proviso is:

  1. When I log-in I am taken to the Forum home page
  2. When I log-out I am taken to the Wiki home page

I have the following in my Page Top Menu:

(:if equal {$AuthId} guest:)
* Welcome guest | [[{*$FullName}?action=login | Log In]]
(:if ! equal {$AuthId} guest:)
* [[{*$FullName}?action=logout | Log Out {$AuthId}]]
* %rel=nofollow accesskey=$[ak_edit]%[[{*$FullName}?action=edit | $[Edit] ]]

Is there a 'fix' for this such that I can in each case actually stay on the same page as I was before I hit the log-in / log-out button.


webmaster [snail] classic-sf [period] co [period] uk

Hi, I have the same problem. It's very good recipe, but I can't use it, because i see the smf main page after login. netDalek [snail] gmail [period] com


I have having the same issue as Matthias except I do not have duplicate DefaultPassword('admin') entries.

SMF works fine, but I cannot edit the wiki. I am thrown back to SMF after login.

It must be a simple error on my part, but I cannot figure it out. Any ideas?

JohnPayne -- sycarion [snail] gmail [period] com

Use markup (:smf-login {$PageUrl}:) to display a login form which leave you on the same page after successful login. If you use a login action link like [[{*$FullName}?action=login | Log In]] then you could create a page Site.SMFAuthForm with the form markup as per instructions above. Otherwise the login will use the SMF login form, but still in the wiki page. I do not understand why you are redirected after login. - HansB

Hans, your handling of ssi_login isen't sufficient for the latest SMF (2.1.11) so i've added a small hack to auth-smf.php juts for ssi_login so that it would redirect back to the right page upon login rather than just my forum homepage. add this before:

 # call ssi function (from SMF module SSI.php)


		if ($fn == 'ssi_login') {
			$arg1 = '[(approve links)
                        $arg2 = 'echo';

I just threw in the action=edit because my users only get asked to login upon edit.this workeded, I had the problem of when login out of my forum you where redirected to PMwiki home so i used the hack in the first comment above and it works fine, Interestingly I didn't have the oposite issue. Anyways, thanks! Horthon?

Hello Hans, I installed everything and it nearly worked. So I can display the post, topics, new and so on from smf on my page, but if I include the entries you mention in my local config.php I can't edit my wiki anymore. There is a prompt for user and password and I couldn't manage to get in, until I delete the smf entries in my local config.php. Is this maybe a bug? Thanks --MatthiasGünther

Have you set edit permissions for the wiki? Add to config.php:

$DefaultPasswords['admin'] = '@admin';
$DefaultPasswords['edit'] = '@editor';

For testing, put into a wiki page

*AuthId: {$AuthId}
*Author: {$Author}
*{$UserName}: {$UserEmail}
HansB June 27, 2008, at 09:38 AM

Hello Hans, the {$Author}and {$UserName}: {$UserEmail} are correct but the {$AuthId} show the same entry as {$Author} --MatthiasGünther

That will be the case if in SMF your login name is the same as your "real name". Are the default passwords set after including auth-smf.php? -HansB

Hello Hans, yes I insert them after including auth-smf.php. Nevertheless if I change $DefaultPasswords['edit'] = '@editor'; to $DefaultPasswords['edit'] = 'bla'; the output is the same. --MatthiasGünther

$DefaultPasswords['edit'] = crypt('bla'); would make bla the general edit password.
$DefaultPasswords['edit'] = array('@editor', crypt('bla')); would make bla the general edit password and also all who are authenticated as @editor, i.e. SMF members of the Global moderator group.

Hello Hans, now it works. I had annother DefaultPasswords['admin'] in my config.php, such a stupid mistake :). Thanks for your help --MatthiasGünther

Talk page for the Auth-SMF recipe (users?).