Documentation >> Conditionals >> users >> username
Conditional Macro: username
Operators:
- == (equal to)
- != (not equal to)
Usage Notes
- Tests the username (the logon ID) of the current user against the value provided. (Current user is defined as the person for whom the page is intended, at the time the macro is being processed.)
- Note that if the current user is not a member of the conversation, or is a member but has not logged on, his username is "guest".
- Email has two modes: single subscriber (which uses a mailing list engine), and multi-subscriber (which sends the message separately to each person).
- In single subscriber mode (the default for all Free-Conversant sites), the username is set to "guest" because it's only being rendered once for all members.
- In mutli-subscriber mode, the username is exactly the same as if the user had logged in via the web browser: it is the user's ID.
- The |conditional value| that is compared with it must be either a valid user ID (an email address), or the word "guest". If the username for the current user is the same as whatever |conditional value| you provide, then the macro will evaluate to true.
- See also the regular macro membername, which returns a displayable version of the current user's logon id. This means that the conditional expression
"username=='<!--#membername-->'" will always be true (and is therefore a useless conditional macro).
- This macro is especially useful for webmasters who want to put links or controls on the page which can only be seen by themselves.
Examples
This example would show line 1 to Greg Pierce, line 2 to Philippe Martin, and line 3 to everybody else.
<!--#if condition="username=='[email protected]'"-->
1. Only Greg Pierce would see this line.
<!--#elseif condition="username=='[email protected]'"-->
2. Only Philippe Martin would see this line.
<!--#else-->
3. Everybody except Greg Pierce and Philippe Martin will see this line.
<!--#endIf-->
See the above code in action, here:
3. Everybody except Greg Pierce and Philippe Martin will see this line.
View in DG
|