[pmwiki-users] Is there a way to disable a cookbook in some Group and how ?

ABClf languefrancaise at gmail.com
Fri Jan 29 00:51:41 CST 2010


Thank you Dave,

My syntax wasn't working ; I corrected errors and now it looks like
it's working.
Can someone confirm that, in config, the "if not" has to be written !=
(third line)

$pagename = ResolvePageName($pagename);  #undo clean urls (replace /
with .) to make pagename checks easier
list($group, $name) = explode('.', $pagename);

if ($group != 'Private' && $action == 'edit') {
include_once("$FarmD/cookbook/authorcontrib.php"); }

Gilles.

ps : I have found
http://www.pmwiki.org/wiki/Cookbook/ConditionalMarkupSamples#recipe-loaded
useful to check wether the cookbook was loaded or not.

$pagename = ResolvePageName($pagename);  #undo clean urls (replace /
with .) to make pagename checks easier
list($group, $name) = explode('.', $pagename);

if (!$group == 'P' && $action == 'edit') {
include_once("$FarmD/cookbook/authorcontrib.php"); }

That blocks too other group.
I don't see where is the trouble : doesn't the « if condition » says :
if not group P + if action=edit ?



2010/1/28 DaveG <pmwiki at solidgone.com>:
>
>
> On 1/28/2010 4:50 PM, ABClf wrote:
>>
>> Hello !
>>
>> My question : is there a way to disable a cookbook in some Group and how ?
>> If one loads a cookbook X using config.php, then, is there a way to
>> disable this cookbook for PrivateGroup ; or, same purpose, is there a
>> way to load the cookbook for all the site but PrivateGroup ?
>>
>> For example, does this kind of conditional line work in config.php ?
>>
>> if!($group == 'PrivateGroup')
>> elseif ($action == 'edit' || $action == 'comment') {
>> include_once("$FarmD/cookbook/authorcontrib.php"); }
>
> That should work, but you'd need to get $group first. There are a number of
> ways to do that, here's one:
>  $pagename = ResolvePageName($pagename);  #undo clean urls (replace / with
> .) to make pagename checks easier
>  list($group, $name) = explode('.', $pagename);
>
>
>



-- 
---------------------------------------
| A | de la langue française
| B | http://www.languefrancaise.net/
| C | languefrancaise at gmail.com
---------------------------------------



More information about the pmwiki-users mailing list