Functions

Mass-load details for a list of members into memory, to reduce queries when we access it later.

cns_cache_member_details(array $members) 
package cns_forum

Parameters

$members

array

List of members.

Turn a post row, into a detailed map of information that is suitable for use as display parameters for that post.

cns_get_details_to_show_post(array $_postdetails, array $topic_info, boolean $only_post = false) : array
package cns_forum

Parameters

$_postdetails

array

The post row.

$topic_info

array

The topic row.

$only_post

boolean

Whether the post is the only post in the topic.

Returns

arrayThe detailed map.

Get a map of details relating to the view of a certain forum of a certain member.

cns_get_forum_view(\AUTO_LINK $forum_id, array $forum_info, integer $start = 0, \?integer $max = null) : array
package cns_forum

Parameters

$forum_id

\AUTO_LINK

The forum ID.

$forum_info

array

The forum row.

$start

integer

The start row for getting details of topics in the forum (i.e. 0 is newest, higher is starting further back in time).

$max

\?integer

The maximum number of topics to get detail of (null: default).

Returns

arrayThe details.

Get post emphasis Tempcode.

cns_get_post_emphasis(array $_postdetails) : \Tempcode
package cns_forum

Parameters

$_postdetails

array

Map of post info.

Returns

\TempcodeThe Tempcode.

Get a map of details relating to the Private Topics of a certain member.

cns_get_private_topics(integer $start = 0, \?integer $max = null, \?MEMBER $member_id = null) : array
package cns_forum

Parameters

$start

integer

The start row for getting details of topics in the Private Topic forum (i.e. 0 is newest, higher is starting further back in time).

$max

\?integer

The maximum number of topics to get detail of (null: default).

$member_id

\?MEMBER

The member to get Private Topics of (null: current member).

Returns

arrayThe details.

Get details of a topic (to show eventually as a row in a forum or results view). This is a helper function, and thus the interface is not very user friendly.

cns_get_topic_array(array $topic_row, \MEMBER $member_id, integer $hot_topic_definition, boolean $involved) : array
package cns_forum

Parameters

$topic_row

array

The DB row of the topic.

$member_id

\MEMBER

The member the details are being prepared for.

$hot_topic_definition

integer

The hot topic definition (taken from the config options).

$involved

boolean

Whether the viewing member has a post in the topic.

Returns

arrayThe details.

Read in a great big map of details relating to a topic.

cns_read_in_topic(\?AUTO_LINK $topic_id, integer $start, integer $max, boolean $view_poll_results = false, boolean $check_perms = true) : array
package cns_forum

Parameters

$topic_id

\?AUTO_LINK

The ID of the topic we are getting details of (null: whispers).

$start

integer

The start row for getting details of posts in the topic (i.e. 0 is start of topic, higher is further through).

$max

integer

The maximum number of posts to get detail of.

$view_poll_results

boolean

Whether we are viewing poll results for the topic (if there is no poll for the topic, this is irrelevant).

$check_perms

boolean

Whether to check permissions.

Returns

arrayThe map of details.

Render the Conversr forumview.

cns_render_forumview(\?integer $id, \?array $forum_info, string $current_filter_cat, integer $max, integer $start, \AUTO_LINK $root, \?MEMBER $of_member_id, \Tempcode $breadcrumbs) : mixed
package cns_forum

Parameters

$id

\?integer

Forum ID (null: private topics).

$forum_info

\?array

The forum row (null: private topics).

$current_filter_cat

string

The filter category (blank if no filter)

$max

integer

Maximum results to show

$start

integer

Offset for result showing

$root

\AUTO_LINK

Virtual root

$of_member_id

\?MEMBER

The member to show private topics of (null: not showing private topics)

$breadcrumbs

\Tempcode

The breadcrumbs

Returns

mixedEither Tempcode (an interface that must be shown) or a pair: The main Tempcode, the forum name (string). For a PT view, it is always a tuple, never raw Tempcode (as it can go inside a tabset).

Get buttons for showing under a post.

cns_render_post_buttons(array $topic_info, array $_postdetails, boolean $may_reply, \ID_TEXT $rendering_context = 'cns') : \Tempcode
package cns_forum

Parameters

$topic_info

array

Map of topic info.

$_postdetails

array

Map of post info.

$may_reply

boolean

Whether the current member may reply to the topic

$rendering_context

\ID_TEXT

Rendering context

Returns

\TempcodeThe buttons.

Render a topic row (i.e. a row in a forum or results view), from given details (from cns_get_topic_array).

cns_render_topic(array $topic, boolean $has_topic_marking, boolean $pt = false, \?string $show_forum = null) : \Tempcode
package cns_forum

Parameters

$topic

array

The details (array containing: last_post_id, id, modifiers, emoticon, first_member_id, first_username, first_post, num_posts, num_views).

$has_topic_marking

boolean

Whether the viewing member has the facility to mark off topics (send as false if there are no actions for them to perform).

$pt

boolean

Whether the topic is a Private Topic.

$show_forum

\?string

The forum name (null: do not show the forum name).

Returns

\TempcodeThe topic row.

Find the URL to the latest unread post in a topic.

find_first_unread_url(\AUTO_LINK $id) : \URLPATH
package cns_forum

Parameters

$id

\AUTO_LINK

The topic ID.

Returns

\URLPATHThe URL.

Find the URL to a post.

find_post_id_url(\AUTO_LINK $post_id) : \URLPATH
package cns_forum

Parameters

$post_id

\AUTO_LINK

The post ID.

Returns

\URLPATHThe URL.