Question

How can I show some text conditionally, depending who is looking at the topic?

Answer

Use some SpreadSheetPlugin magic to hide content conditionally. Set a Spreadsheet variable to the list of invided people who should be able to see the content.

Note: Do not use this method to hide confidential content since it is possible to view the raw text of a topic.

Example

You type:

Initialize:
%CALC{$SET(invited, PeterThoeny, OtherPerson)}%
%CALC{$SET(hide, $NOT($LENGTH($LISTIF($EXACT($item, %WIKINAME%), $GET(invited)))))}%

Show single line of text based on a condition:
%CALC{$IF($GET(hide), _Sorry you do not have access!_, _OK you are in!_)}%

Hide multiple lines of text based on a condition:
%CALC{$IF($GET(hide), <!--)}%
   * This text can only be seen by people in the invited list
   * You are in the list
%CALC{$IF($GET(hide), -->)}%

Show multiple lines of text based on a condition:
%CALC{$IF($GET(hide), , <!--)}%
   * There is text that can only be seen by people in the invited list
   * Sorry, you are not in the list
%CALC{$IF($GET(hide), , -->)}%

You get:

Initialize:

Show single line of text based on a condition: Sorry you do not have access!

Hide multiple lines of text based on a condition:

Show multiple lines of text based on a condition:

  • There is text that can only be seen by people not in the invited list
  • Sorry, you are not in the list

-- PeterThoeny? - 12 May 2005

Topic revision: r1 - 2007-06-18 - 06:55:23 - ChrisHogan
 
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Everiware? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.ConditionalTextByUser