Knowledge Base

Alternative Syntax for User Global Variables

Occasionally, a module’s own tag variables will collide with User Globals, which might lead to unexpected output depending on whether you were wanting the Global variable’s value, or the module’s tag variable value.  For instance, the Weblog module has a {username} variable that displays the username of the author of an entry, and will supercede the {username} Global variable which displays the username of the currently logged in user.

In cases like these, there is an alternative syntax for displaying information about the currently logged in user.  You may use either of the following:

{out_varname}

or

{global->varname}

This syntax works for all of User Global variables:

{member_id}
{group_id}
{member_group}
{username}
{screen_name}
{email}
{ip_address}
{location}
{total_entries}
{total_comments}
{private_messages}
{total_forum_posts}
{total_forum_topics}

Example:

{out_username}

Member Variables alternative syntax

In order to be able to use some member variables inside tags that already parse their own member information, such as the weblog entries tag, it is necessary to use an alternative syntax. All of the member variables may be used with the addition of the prefix “logged_in_”.  A full list of variables is available on the Standard Global Variables userguide page.

Last Updated on Apr 13, 2007 at 00:31   ( Permalink )
Category: Templates, Other, Technical Issues, Miscellaneous