SID-01587: SKIN assignment based on the user's group
| Status: |
Answered |
TWiki version: |
5.1.2 |
Perl version: |
Perl 5.10.1 |
| Category: |
CategorySkin |
Server OS: |
GNU/Linux 2.6.32-279.5.2.el6.x86_64 |
Last update: |
13 years ago |
How do I assign a skin based on the users group?
I have created two different SKINS, which we will call BLUE and RED. And I have two User Groups with we will call BigGroup and LittleGroup. How can I ensure that members of BigGroup will get the BLUE skin and LittleGroup will get the RED skin?
Is this done in the template or in TWikiPreferences?
--
BobMellinger - 2012-11-16
Discussion and Answer
This is currently not possible, but here is a patch for
twiki/lib/TWiki.pm:
--- TWiki.pm (revision 24029)
+++ TWiki.pm (working copy)
@@ -1144,6 +1144,11 @@
$skinpath = $epidermis.','.$skinpath if $epidermis;
}
+ if( $skinpath =~ /\%[A-Z]/ ) {
+ $skinpath = $this->handleCommonTags( $skinpath, $this->{webName},
+ $this->{topicName} );
+ }
+
return $skinpath;
}
Once the patch is applied you can add this setting:
* Set SKIN = %IF{ "'%WIKINAME%' ingroup 'BigGroup'" then="blue" else="red" }%
--
PeterThoeny - 2012-11-17
I added feature proposal
ConditionalSkin.
--
PeterThoeny - 2012-11-17
Thanks Peter. One follow up question - after making the patch you provided, where do I add the Set SKIN setting so that each group gets the correct skin?
--
BobMellinger - 2012-11-17
Never mind. I looked at this topic with Raw View and saw the $IF coding you put in your reply. I'll give it a try and post how it worked.
Thanks.
--
BobMellinger - 2012-11-17
Made the patch to TWiki.pm, added the $IF coding to the Preferences and it works perfectly. Even went on to create a somewhat more complex $IF and it too worked. Thanks VERY much.
--
BobMellinger - 2012-11-17
Your welcome. I fixed the SKIN setting example.
--
PeterThoeny - 2012-11-18
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.