[pmwiki-users] Page question

Hans design5 at softflow.co.uk
Sat Jun 21 13:04:33 CDT 2008


Saturday, June 21, 2008, 8:28:50 AM, Hans wrote:

> I would think it should be easy to design using AuthUser;
> then you got user names with associated passwords.
> You just need to design the Login Form so on successful login
> of a user it redirects to the ClientGroup.{$AuthId}  page.

I got this working now by using a custom {(redir PageName)}
markup expression. Install AuthUser and add to config.php

$MarkupExpr['redir'] = 'RedirMx($pagename, $args[0])';
function RedirMx($pagename, $n) {
        global $AuthId, $action;
        if ($action == 'edit' || $AuthId=='') return '';
        if (substr($n,-1)=='.') return ""; #incomplete pagename provided
        $pn = MakePageName($pagename, $n);
        Redirect($pn, @"{\$PageUrl}?from=$pagename");
        exit();
}

then use in a page for Login:

[[{$FullName}?action=login|login]]

(:if !authid '' :)
{(redir 'Profiles.{$AuthId}' )} 
(:ifend:)


after login with user name 'Bob' for instance you will be
automatically redirected to page 'Profiles.Bob'

If you are not logged in, you will see the login link on the page,
if you are logged in you are always redirected to the user page.

Note this needed a custom markup to do the redirection; the normal
(:redirect PageName:) directive does not work.


  ~Hans




More information about the pmwiki-users mailing list