[pmwiki-users] How to use if ($page['=auth']['edit'])

Tom Lederer celok at gmx.net
Sat Sep 9 21:23:23 CDT 2006


Hi,

thanks for the quick answer. Unfortunatly it does not work. It still  
shows the authorized view even for not logged in people. They can't  
edit the page though.

I have no EnableIMS or like that in config.php.

Man, sometimes i wish i'd _really_ knew php ;)

Best Regards,
Tom

-- 

Tom
http://www.celok.de
http://www.frappr.com/celok


Am 10.09.2006 um 03:52 schrieb Patrick R. Michaud:

> On Sat, Sep 09, 2006 at 10:27:02PM +0200, Tom Lederer wrote:
>> Hi all,
>> after reading http://www.pmwiki.org/wiki/Cookbook/
>> ConditionalMarkupSamples
>> i assumed that i could use if ($page['=auth']['edit']) in a file:
>>
>> What i try to do is
>>
>> Markup("taghead",       "directives", '/\\(:markupname:\\)/
>> ei',        'Keep(MarkupFunction())');
>>
>> this should display different things to a editor than to a reader. So
>> i did:
>>
>> function MarkupFunction() {
>>      global $pagename,$ScriptUrl;
>>      $page = RetrieveAuthPage($pagename, 'read', false,
>> READPAGE_CURRENT);
>>      if ($page['=auth']['edit']) {
>> 	return "You have edit rights.";	
>>      }
>>      else {
>> 	return "Read only.";
>>      }
>> }
>
> Since the page is already loaded into the cache by the time the
> markup is processed, it's a bit faster to do:
>
>     global $PCache, $pagename;
>     if ($PCache[$pagename]['=auth']['edit']) {
>       return 'You have edit rights.';
>     } else {
>       return 'Read only.';
>     }
>
>> Does anyone spot an error, or can tell me how to accomplish this?
>
> I don't immediately see an error with what you're doing, however,
> so I'm not exactly sure what's going on.
>
> Are you running your site with $EnableIMS set?  If so, you
> might be seeing the effects of the browser cache.
>
> Pm
>





More information about the pmwiki-users mailing list