The post object

The post object represents a forum post.


subject

Returns the post subject.

Syntax:

subject → string

Returns:

The post subject.

Example:

This code outputs the subject of the first post in "topic1":

<#assign post = topic1.first>
<p>The post subject is ${post.subject}.</p>

Which will result in something like:

The post subject is Welcome to the Liquid Site forum.


subjectSource

Returns the unprocessed post subject.

Syntax:

subjectSource → string

Returns:

The unprocessed post subject.

Example:

This code outputs the unprocessed subject of the first post in "topic1":

<#assign post = topic1.first>
<p>The post subject is ${post.subjectSource}.</p>

Which will result in something like:

The post subject is <p>Welcome to the Liquid Site forum</p>.


text

Returns the post text.

Syntax:

text → string

Returns:

The post text.

Example:

This code outputs the text of the first post in "topic1":

<#assign post = topic1.first>
<p>The post text is ${post.text}.</p>

Which will result in something like:

The post text is I hope you'll enjoy it!.


textSource

Returns the unprocessed post text.

Syntax:

textSource → string

Returns:

The unprocessed post text.

Example:

This code outputs the unprocessed text of the first post in "topic1":

<#assign post = topic1.first>
<p>The post text is ${post.textSource}.</p>

Which will result in something like:

The post text is <p>I hope you'll enjoy it!</p>.


created

Returns the post created date.

Syntax:

created → date

Returns:

The post created date.

Example:

This code outputs the created date of the first post in "forum1":

<#assign post = liquidsite.findDocument("Section1/forum1").first>
<p>The post created date is ${post.created}.</p>

Which will result in something like:

The post created date is 2005-01-15.


date

Returns the post revision date.

Syntax:

date → date

Returns:

The post revision date.

Example:

This code outputs the revision date of the first post in "forum1":

<#assign post = liquidsite.findDocument("Section1/forum1").first>
<p>The post revision date is ${post.date}.</p>

Which will result in something like:

The post revision date is 2005-01-21.


id

Returns the post id.

Syntax:

id → number

Returns:

The post id.

Example:

This following code outputs the first post id:

<#assign post = liquidsite.forum.first.first>
The post id is ${post.id}.

name

Returns the post name.

Syntax:

name → string

Returns:

The post name.

Example:

The following code outputs the first post name:

<#assign post = liquidsite.forum.first.first>
The post name is ${post.name}.

lock

Returns the post lock object.

Syntax:

lock → lock object

Returns:

The post lock object.

Example:

This code gets the lock object of the first post in "forum1", and stores it in a variable:

<#assign lock = liquidsite.findDocument("Section1/forum1").first.lock>

online

Returns the post online flag.

Syntax:

online → boolean

Returns:

True if the post is online, false otherwise.

Example:

This code gets the online flag of the first post in "forum1", and stores it in a variable:

<#assign online = liquidsite.findDocument("Section1/forum1").first.online>

parent

Returns the parent topic of the post.

Syntax:

parent → topic object

Returns:

The parent topic under which the post is located.

Example:

This code gets the parent of the first post in "topic1", and stores it in a variable:

<#assign parent = liquidsite.findDocument("Section1/forum1").first.parent>

In this case the parent is "topic1".


path

Returns the post path.

Syntax:

path → string

Returns:

The post path.

Example:

This code outputs the path of the first post in "forum1":

<#assign path = liquidsite.findDocument("Section1/forum1").first.path>
<p>The path is ${path}.</p>

The result will be:

The path is Section1/forum1.


revision

Returns the post revision number.

Syntax:

revision → number

Returns:

The post revision number, or zero (0) if the post doesn't exist.

Example:

This code outputs the revision of the first post in "forum1":

<#assign revision = liquidsite.findDocument("Section1/forum1").first.revision>
<p>The revision is ${revision}.</p>

The result will be something like:

The revision is 2.


user

Returns the post revision author.

Syntax:

user → user object

Returns:

The post revision author, or an empty user if the post doesn't exist.

Example:

This code gets the revision author of a post and assigns it to a variable:

<#assign user = liquidsite.findDocument("Section1/forum1").user>

hasAccess

Checks whether the current logged in user has a specified permission over the post. See the document object for information about the allowed permission values.

Syntax:

hasAccess(permission) → boolean

Returns:

True if the current logged in user has the specified permission over the post, false otherwise.

Example:

This code checks whether the current logged in user has read access to a post:

<#if liquidsite.findDocument("Section1/forum1").hasAccess("read")>