The forum object
The forum object is used to access the information about a forum.
-
created
Returns the forum created date. -
date
Returns the forum revision date. -
description
Returns the forum description. -
findTopics(offset,
count)
Returns a number of topics in the forum. -
first
Returns the first topic in the forum. -
hasAccess(permission)
Checks whether the current logged in user has a specified permission over the forum. -
id
Returns the forum id. -
isModerator(user)
Checks whether a user is a forum moderator. -
last
Returns the last topic in the forum. -
lock
Returns the forum lock object. -
moderator
Checks whether the current logged in user is a forum moderator. -
name
Returns the forum name. -
online
Returns the forum online flag. -
parent
Returns the parent section of the forum. -
path
Returns the forum path. -
realName
Returns the real forum name. -
revision
Returns the forum revision number. -
topicCount
Returns the number of topics in the forum. -
user
Returns the forum revision author.
findTopics
Returns a number of topics in the forum.
Syntax:
findTopics(offset, count) → sequence
of topic objects
Parameters:
-
offset-- the number of topics to skip -
count-- the maximum number of topics to return
Returns:
A list of at most count topics in
the forum, beginning at topic number offset.
Example:
This code loops through the first ten topics in a forum:
<#list liquidsite.findDocument("Section1/forum1").findTopics(0, 10)>
description
Returns the forum description.
Syntax:
description → string
Returns:
The forum description.
Example:
This code output the description of a forum:
<p>The description of "forum1" is ${liquidsite.findDocument("Section1/forum1").description}.</p>
Which will output something like:
The description of "forum1" is The description of forum1.
first
Returns the first topic in the forum.
Syntax:
first → topic
object
Returns:
The first topic in this forum.
Example:
This code gets the first topic in a forum and assigns it to a variable:
<#assign firstTopic = liquidsite.findDocument("Section1/forum1").first>
last
Returns the last topic in the forum.
Syntax:
last → topic
object
Returns:
The last topic in this forum.
Example:
This code gets the last topic in a forum and assigns it to a variable:
<#assign lastTopic = liquidsite.findDocument("Section1/forum1").last>
moderator
Checks whether the current logged in user is a moderator of the forum.
Syntax:
moderator → boolean
Returns:
True if the current logged in user is a moderator of the forum, false otherwise.
Example:
This code checks whether the user is a moderator of a forum:
<#id liquidsite.findDocument("Section1/forum1").moderator>
isModerator
Checks whether the specified user is a forum moderator.
Syntax:
isModerator(user) → boolean
Parameters:
-
user-- the user login name string or the user object
Returns:
True if the specified user is a moderator of the forum, or false otherwise.
Example:
This code checks whether the user "test" is a moderator of the current forum:
<#if liquidsite.forum.isModerator("test")>
Moderator
</#if>
name
Returns the forum name.
Syntax:
name → string
Returns:
The forum name.
Example:
The following code outputs the forum name:
The forum name is ${liquidsite.forum.name}.
realName
Returns the real forum name.
Syntax:
realName → string
Returns:
The real forum name.
Example:
This code output the real name of a forum:
<p>The real name of "forum1" is ${liquidsite.findDocument("Section1/forum1").realName}.</p>
Which will output something like:
The realName of "forum1" is The real name of forum1.
topicCount
Returns the number of topics in the forum.
Syntax:
topicCount → string
Returns:
The forum topicCount.
Example:
This code loops through all topics in a forum:
<#assign forum = liquidsite.findDocument("Section1/forum1")>
<#list forum.findTopics(0, forum.topicCount)>
created
Returns the forum created date.
Syntax:
created → date
Returns:
The forum created date.
Example:
This code outputs the forum created date:
<#assign forum = liquidsite.findDocument("Section1/forum1")>
<p>The forum created date is ${forum.created}.</p>
Which will result in something like:
The forum created date is 2005-01-15.
date
Returns the forum revision date.
Syntax:
date → date
Returns:
The forum revision date.
Example:
This code outputs the forum revision date:
<#assign forum = liquidsite.findDocument("Section1/forum1")>
<p>The forum revision date is ${forum.date}.</p>
Which will result in something like:
The forum revision date is 2005-01-21.
id
Returns the forum id.
Syntax:
id → number
Returns:
The forum id.
Example:
This code outputs the forum id:
<#assign forum = liquidsite.findDocument("Section1/forum1")>
<p>The forum id is ${forum.id}.</p>
Which will result in something like:
The forum id is 123.
lock
Returns the forum lock object.
Syntax:
lock → lock
object
Returns:
The forum lock object.
Example:
This code gets the lock object of a forum and stores it in a variable:
<#assign lock = liquidsite.findDocument("Section1/forum1").lock>
online
Returns the forum online flag.
Syntax:
online → boolean
Returns:
True if the forum is online, false otherwise.
Example:
This code gets the online flag of a forum and stores it in a variable:
<#assign online = liquidsite.findDocument("Section1/forum1").online>
parent
Returns the parent section of the forum.
Syntax:
parent → section object
Returns:
The parent section under which the forum is located.
Example:
This code gets the parent of a forum and stores it in a variable:
<#assign parent = liquidsite.findDocument("Section1/forum1").parent>
In this case the parent of "forum1" is "Section1".
path
Returns the forum path.
Syntax:
path → string
Returns:
The forum path.
Example:
This code outputs the path of a forum:
<#assign path = liquidsite.findDocument("Section1/forum1").path>
<p>The path of "forum1" is ${path}.</p>
The result will be:
The path of "forum1" is Section1/forum1.
revision
Returns the forum revision number.
Syntax:
revision → number
Returns:
The forum revision number, or zero (0) if the forum doesn't exist.
Example:
This code outputs the revision of a forum:
<#assign revision = liquidsite.findDocument("Section1/forum1").revision>
<p>The revision of "forum1" is ${revision}.</p>
The result will be something like:
The revision of "forum1" is 2.
user
Returns the forum revision author.
Syntax:
user → user
object
Returns:
The forum revision author, or an empty user if the forum doesn't exist.
Example:
This code gets the revision author of a forum and assigns it to a variable:
<#assign user = liquidsite.findDocument("Section1/forum1").user>
hasAccess
Checks if the current user has a specified access permission to the forum. The input permission types available are:
- read -- for reading permission (always true)
- write -- for writing permission
- publish -- for publishing permission
- admin -- for administration permission
Syntax:
hasAccess(permission) → boolean
Parameters:
-
permission-- the string containing the permission type (as above)
Returns:
True if the current user has the specified permission, or false otherwise.
Example:
This code checks whether the current user has read access to a forum:
<#if liquidsite.forum1.hasAccess("read")>
