[pmwiki-users] Re: Supporting different modes in default pmwiki

Patrick R. Michaud pmichaud at pobox.com
Sun Aug 7 10:42:46 CDT 2005


On Sun, Aug 07, 2005 at 01:57:27PM +0100, Hans wrote:
> Now this should be possible to set also in config.php, rather than
> markup on the pages or the GroupHeader pages. But I have not found out
> how it can be done. $Author and $AuthId don't work in config.php as
> {$Author} and {$AuthId} work on a wiki page. 

They work if you include the relevant scripts that set the values:

    include_once("$FarmD/scripts/author.php");
    include_once("$FarmD/scripts/authuser.php");

    if ($AuthId == 'idname') ...... ;

If you're wondering "why doesn't PmWiki automatically do these
before processing config.php", it's because each of those scripts
may depend on certain configuration variables being set prior to
doing their processing.

More generally, in config.php one can do:

    include_once("$FarmD/scripts/stdconfig.php");

which says to do go ahead and perform all of PmWiki's standard
configuration processing at this point (markups, skins, authors,
user preferences, setting variables, etc.).  Then the config.php
script can pick up with any other customizations it wants to do.

> And I don't know what the equivalent is to (:if auth admin:) ... etc.
> in config.php. If we know this we would have the required 'mode'
> switch.

There pretty much isn't a direct equivalent -- the closest is:

    $page = RetrieveAuthPage($pagename, 'read', false);
    if ($page['=auth']['admin']) { ... }

Pm




More information about the pmwiki-users mailing list