Loading...
 
Skip to main content

Features / Usability


Variable Usage in Smarty Coding

posts: 35 United States

I'd like to include an "if" statement in my smarty coding that matches whether the current user is a member of a specific group. I'm generating a customized menu in the right column of http://tbChampaign.com — and now need to add an option if the user is a member of a specific group.

I know you can check for permissions using something like:

{ if $tiki_p_admin eq 'y' }

and that $ user contains the user's name. But I don't know what to check to verify membership in a specific group (OR I suppose I could add a permission for it, or .. ?)


Is there a list of variables and/or structures that are available while generating a wiki page?

Thanks in advance!

Norm

posts: 35 United States

a) Bump this, perhaps someone will notice it and reply.

b) Since noone has replied, I thought that I'd come up with a solution — just create a second "QuickLinks" menu that is assigned to a specific group, and put that under the other module. Not quite as nice as I would like (see http://tbchampaign.com - I have a custom menu for the site that goes only to the pages that I want; I don't want people confused with the expanding default wiki menu), but .. it should work, no?

No, it didn't. Imagine my surprise when I tried to create a second "quicklinks" menu and found I was editing the first one .. is there a way to create another module that is fully editable and not one of the preconfigured options? I want to just put smarty/link coding in it and display it on the right menubar. I've put a header of "On this site.." on the first quicklinks module; I assume I could create a second with another header and go from there.


posts: 113 Ireland

I am not aware of any variable that contains the list of groups that a user is included in. There are functions in lib/userslib.php that return the list of users in a group or other such utilities. But this is not where you really want to go.

I think what you want to do is create a new menu, then assign to a new module and then assign it to be visible only for the appropriate groups.

Admin -> Menus will allow you to create a new menu (say, menuId=43)
Admin -> Modules will allow you to create a new module that uses the created menu. The contents of the module would be { menu id=43 }
Now assign the new module to be visible as appropriate.

gary