Alternative Specific Users Only

By Timothy FosterTimothy Foster

Description

The original Specific Users Only CSI was engineered by James Kanjo. This include allows Wikidot users to hide or show data based on who is currently logged on. This means you can easily hide certain administrative links from common viewers.

The original CSI works brilliantly, but this alternative version attempts to eliminate some of the limitations the original had. Namely:

  • Modules (like NewPage and ListPages) may be used within the SUO body
  • Live Template variables may be used within the SUO body
  • In hidefrom mode, anonymous users will see the information

Syntax

The syntax is the same as for the original SUO. However, the Alternative SUO is now always in "advanced" mode, meaning you can use ListPages variables to define users (like %%created_by_unix%%).

Attribute Default Value Description
type Required! Either showto or hidefrom. This specifies whether to show or hide data from the listed users.
unique default Required when using multiple SUOs on a single page. Can be any alphanumeric sequence with hyphens, not do NOT use spaces.
user none The UNIX name of a user to which data will be shown to (or hidden from if in hidefrom mode). Being a UNIX name, no spaces are allowed, and all letters should be lowercase. In place of spaces, use hyphens.
user0 Same as above
user1
user99 Supports up to 101 users.

Code

[[include :snippets:alt-suo |unique=first |type=showto |user1=timothy-foster |user2=michal-frackowiak]]
**Hello Timothy Foster & Michał Frąckowiak!!!**
[[/div]]

[[include :snippets:alt-suo |unique=second |type=hidefrom |user1=timothy-foster |user2=michal-frackowiak]]
**Hello Everybody Else!!!**
[[/div]]

Note: The ending [[/div]] can be replaced with the following in order to be compatible with how the original SUO works:

[[include :snippets:alt-suo]]

In action

Hello Timothy Foster & Michał Frąckowiak!!!

Hello Everybody Else!!!

Important

While this alternative eliminates some of the limitations of the original, it still has the limitation that it cannot be used within modules itself.


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by Timothy Foster

Fancy HR Dividers - 07 Apr 2021 06:23
Carousel - 24 May 2015 01:18
Modal Image - 01 May 2015 17:20
Bootstrap Image Box - 19 Jul 2014 01:27
Togglecheck - 17 Dec 2013 20:27
Image Box - 10 Dec 2013 03:14
Toggle Tag - 19 Jul 2013 11:13
Hide Tags - 14 Feb 2013 21:35
Plurality Checker - 16 Jul 2012 03:21
Mini Chat Area - 15 May 2012 12:04
Table Alterations - 16 Feb 2012 01:45


Rate this solution

If you think this solution is useful — rate it up!

rating: +7+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License