[pmwiki-users] Author Setting

H. Fox haganfox at users.sourceforge.net
Fri Dec 16 04:24:04 CST 2005


On 12/16/05, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Dec 16, 2005 at 09:36:51AM +0000, Alan Perryman wrote:
> > (psudocode)
> >
> > if(logged in == true)
> > Author = Logged In User Name
> > else
> > reject edit ()
>
> Try (assuming you're using authuser):
>
>    # ... settings here
>    include_once('scripts/authuser.php');
>
>    if (@$AuthId) $Author = $AuthId;
>    else {
>      $EnablePost = 0;
>      $MessagesFmt[] = "Posting not allowed w/o login";
>    }

I'm pretty sure you need to get the verified author identity from the session.

Somewhere after

    @include_once('scripts/authuser.php');

you'll want

    ## Require an author name.
    $EnablePostAuthorRequired = 1;
    ## Enforce Author tracking based on the authenticated user.
    if ($action == 'edit') @session_start();
    if (@$_SESSION['authid']) $Author=$_SESSION['authid'];

See http://www.pmwiki.org/wiki/Cookbook/RequireAuthor#enforce

Hagan




More information about the pmwiki-users mailing list