Tags:
create new tag
view all tags

SID-01587: SKIN assignment based on the user's group

Status: Answered 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

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title SKIN assignment based on the user's group
SupportCategory CategorySkin
TWiki version 5.1.2
Server OS GNU/Linux 2.6.32-279.5.2.el6.x86_64
Web server Apache 2.2.22
Perl version Perl 5.10.1
Browser & version Chrome 23.0.1271.64
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2012-11-18 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.