Functions

Validate an IP address, indirectly by passing through a confirmation code.

approve_ip_script() 
package core_cns

Store (a hash of) and validate a new password.

bump_password_change_date(\MEMBER $member_id, string $password, string $password_salted, string $salt, boolean $skip_checks = false, \?TIME $time = null
package core_cns

Parameters

$member_id

\MEMBER

The member this is for

$password

string

New password

$password_salted

string

Hashed password

$salt

string

Password salt

$skip_checks

boolean

Whether to skip enforcement checks

$time

\?TIME

The time this is logged to be happening at (null: now)

API function for if password resets have just been turned on but you want some more time before it kicks in.

bump_password_times_forward() 
package core_cns

Give error if Conversr-joining is not possible on this site.

check_joining_allowed() 
package core_cns

Check the complexity of a password.

check_password_complexity(\ID_TEXT $username, string $password, boolean $return_errors = false) : \?Tempcode
package core_cns

Parameters

$username

\ID_TEXT

The username this is for

$password

string

New password

$return_errors

boolean

Whether to return errors instead of dieing on them.

Returns

\?TempcodeError (null: none).

Add a member to a certain usergroup.

cns_add_member_to_group(\MEMBER $member_id, \GROUP $id, \BINARY $validated = 1
package core_cns

Parameters

$member_id

\MEMBER

The member.

$id

\GROUP

The usergroup.

$validated

\BINARY

Whether the member is validated into the usergroup.

Find whether a member of a certain username is bound to HTTP authentication (an exceptional situation, only for sites that use it).

cns_authusername_is_bound_via_httpauth(string $authusername) : \?integer
package core_cns

Parameters

$authusername

string

The username.

Returns

\?integerThe member ID, if it is (null: not bound).

Ban a member.

cns_ban_member(\AUTO_LINK $member_id) 
package core_cns

Parameters

$member_id

\AUTO_LINK

The ID of the member.

Turn a list of maps describing buttons, into a Tempcode button panel.

cns_button_screen_wrap(array $buttons) : \Tempcode
package core_cns

Parameters

$buttons

array

List of maps (each map contains: url, img, title).

Returns

\TempcodeThe button panel.

Check that a member may make a Private Topic.

cns_check_make_private_topic() 
package core_cns

Check a username is valid for adding, and possibly also the password.

cns_check_name_valid(\?SHORT_TEXT $username, \?MEMBER $member_id = null, \?SHORT_TEXT $password = null, boolean $return_errors = false) : \?Tempcode
package core_cns

Parameters

$username

\?SHORT_TEXT

The username (may get altered) (null: nothing to check).

$member_id

\?MEMBER

The member (null: member not actually added yet; this ID is only given for the duplication check, to make sure it doesn't think we are duplicating with ourself).

$password

\?SHORT_TEXT

The password (null: nothing to check).

$return_errors

boolean

Whether to return errors instead of dieing on them.

Returns

\?TempcodeError (null: none).

Check a post would be valid.

cns_check_post(\LONG_TEXT $post, \?AUTO_LINK $topic_id = null, \?MEMBER $poster = null) : \?array
package core_cns

Parameters

$post

\LONG_TEXT

The post.

$topic_id

\?AUTO_LINK

The ID of the topic the post would be in (null: don't check with regard to any particular topic).

$poster

\?MEMBER

The poster (null: current member).

Returns

\?arrayRow of the existing post if a double post (single row map-element in a list of rows) (null: not a double post).

Get a nice list for selection from the forum groupings.

cns_create_selection_list_forum_groupings(\?AUTO_LINK $avoid = null, \?AUTO_LINK $it = null) : \Tempcode
package core_cns

Parameters

$avoid

\?AUTO_LINK

Category to avoid putting in the list (null: don't avoid any).

$it

\?AUTO_LINK

Category selected by default (null: no specific default).

Returns

\TempcodeThe list.

Get a nice, formatted XHTML list of topics, in forum tree structure

cns_create_selection_list_topic_tree(\?AUTO_LINK $it = null) : \Tempcode
package core_cns

Parameters

$it

\?AUTO_LINK

The currently selected topic (null: none selected)

Returns

\TempcodeThe list of topics

Get a nice list for selection from the usergroups. Suitable for admin use only (does not check hidden status).

cns_create_selection_list_usergroups(\?AUTO_LINK $it = null) : \Tempcode
package core_cns

Parameters

$it

\?AUTO_LINK

Usergroup selected by default (null: no specific default).

Returns

\TempcodeThe list.

Decache cached Conversr elements depending on a certain forum, and optionally a certain member.

cns_decache_cms_blocks(\AUTO_LINK $updated_forum_id, \?string $forum_name = null, \?MEMBER $member = null
package core_cns

Parameters

$updated_forum_id

\AUTO_LINK

The ID of the forum.

$forum_name

\?string

The name of the forum (null: find it from the DB).

$member

\?MEMBER

The member (null: do no member decaching).

Delete a custom profile field.

cns_delete_custom_field(\AUTO_LINK $id) 
package core_cns

Parameters

$id

\AUTO_LINK

The ID of the custom profile field.

Delete an emoticon.

cns_delete_emoticon(\SHORT_TEXT $code) 
package core_cns

Parameters

$code

\SHORT_TEXT

The ID of the emoticon to delete.

Delete a forum.

cns_delete_forum(\AUTO_LINK $forum_id, \?AUTO_LINK $target_forum_id = null, \BINARY $delete_topics = 0
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum we are deleting.

$target_forum_id

\?AUTO_LINK

The ID of the forum that topics will be moved to (null: root forum).

$delete_topics

\BINARY

Whether to delete topics instead of moving them to the target forum.

Delete a forum grouping.

cns_delete_forum_grouping(\AUTO_LINK $forum_grouping_id, \?AUTO_LINK $target_forum_grouping_id = null
package core_cns

Parameters

$forum_grouping_id

\AUTO_LINK

The ID of the forum grouping we are editing.

$target_forum_grouping_id

\?AUTO_LINK

The ID of the forum grouping that we will move all the contained forum to (null: the first one).

Delete a usergroup.

cns_delete_group(\AUTO_LINK $group_id, \?GROUP $target_group = null
package core_cns

Parameters

$group_id

\AUTO_LINK

The ID of the usergroup to delete.

$target_group

\?GROUP

The usergroup to move primary members to (null: main members).

Delete a member.

cns_delete_member(\AUTO_LINK $member_id) 
package core_cns

Parameters

$member_id

\AUTO_LINK

The ID of the member.

Delete a multi moderation.

cns_delete_multi_moderation(\AUTO_LINK $id) 
package core_cns

Parameters

$id

\AUTO_LINK

The ID of the multi moderation we are deleting.

Delete a forum poll.

cns_delete_poll(\AUTO_LINK $poll_id, \LONG_TEXT $reason = '', boolean $check_perms = true) : \AUTO_LINK
package core_cns

Parameters

$poll_id

\AUTO_LINK

The ID of the poll we're deleting.

$reason

\LONG_TEXT

The reason for deleting the poll.

$check_perms

boolean

Whether to check permissions.

Returns

\AUTO_LINKThe ID of the topic the poll is on.

Delete a post template.

cns_delete_post_template(\AUTO_LINK $id) 
package core_cns

Parameters

$id

\AUTO_LINK

The ID of the post template to delete.

Delete posts from a topic.

cns_delete_posts_topic(\AUTO_LINK $topic_id, array $posts, \LONG_TEXT $reason = '', boolean $check_perms = true, boolean $cleanup = true) : boolean
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic we're deleting posts from.

$posts

array

A list of posts to delete.

$reason

\LONG_TEXT

The reason for this action.

$check_perms

boolean

Whether to check permissions.

$cleanup

boolean

Whether to do a cleanup: delete the topic if there will be no posts left in it.

Returns

booleanWhether the topic was deleted, due to all posts in said topic being deleted.

Delete a topic.

cns_delete_topic(\AUTO_LINK $topic_id, \LONG_TEXT $reason = '', \?AUTO_LINK $post_target_topic_id = null, boolean $check_perms = true) : \AUTO_LINK
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic to delete.

$reason

\LONG_TEXT

The reason for this action .

$post_target_topic_id

\?AUTO_LINK

Where topic to move posts in this topic to (null: delete the posts).

$check_perms

boolean

Whether to check permissions.

Returns

\AUTO_LINKThe forum ID the topic is in (could be found without calling the function, but as we've looked it up, it is worth keeping).

Delete a formal warning.

cns_delete_warning(\AUTO_LINK $warning_id) : \AUTO_LINK
package core_cns

Parameters

$warning_id

\AUTO_LINK

The ID of the formal warning we are deleting.

Returns

\AUTO_LINKThe member ID the warning was for.

Delete a Welcome E-mail.

cns_delete_welcome_email(\AUTO_LINK $id) 
package core_cns

Parameters

$id

\AUTO_LINK

The ID

Try and make a spacer post look nicer on Conversr than it automatically would.

cns_display_spacer_post(\ID_TEXT $linked_type, \ID_TEXT $linked_id) : array
package core_cns

Parameters

$linked_type

\ID_TEXT

Content type.

$linked_id

\ID_TEXT

Content ID.

Returns

arrayA pair: better description (may be NULL), better post (may be NULL).

Edit a custom profile field.

cns_edit_custom_field(\AUTO_LINK $id, \SHORT_TEXT $name, \SHORT_TEXT $description, \LONG_TEXT $default, \BINARY $public_view, \BINARY $owner_view, \BINARY $owner_set, \BINARY $encrypted, \BINARY $required, \BINARY $show_in_posts, \BINARY $show_in_post_previews, integer $order, \LONG_TEXT $only_group, \ID_TEXT $type, \BINARY $show_on_join_form, \SHORT_TEXT $options) 
package core_cns
set short_text long_text short_trans long_trans integer upload picture url list tick float

Parameters

$id

\AUTO_LINK

The ID of the custom profile field.

$name

\SHORT_TEXT

Name of the field.

$description

\SHORT_TEXT

Description of the field.

$default

\LONG_TEXT

The default value for the field.

$public_view

\BINARY

Whether the field is publicly viewable.

$owner_view

\BINARY

Whether the field is viewable by the owner.

$owner_set

\BINARY

Whether the field may be set by the owner.

$encrypted

\BINARY

Whether the field should be encrypted.

$required

\BINARY

Whether the field is to be shown on the join form

$show_in_posts

\BINARY

Whether this field is shown in posts and places where member details are highlighted (such as an image in a member gallery).

$show_in_post_previews

\BINARY

Whether this field is shown in preview places, such as in the forum member tooltip.

$order

integer

The order of this field relative to other fields.

$only_group

\LONG_TEXT

The usergroups that this field is confined to (comma-separated list).

$type

\ID_TEXT

The type of the field.

$show_on_join_form

\BINARY

Whether it is required that every member have this field filled in.

$options

\SHORT_TEXT

Field options

Edit an emoticon.

cns_edit_emoticon(\SHORT_TEXT $old_code, \SHORT_TEXT $code, \ID_TEXT $theme_img_code, integer $relevance_level, \BINARY $use_topics, \BINARY $is_special = 0
package core_cns
range 0 4

Parameters

$old_code

\SHORT_TEXT

The textual code entered to make the emoticon appear.

$code

\SHORT_TEXT

The old textual code.

$theme_img_code

\ID_TEXT

The image code used for the emoticon.

$relevance_level

integer

The relevance level.

$use_topics

\BINARY

Whether this may be used as a topic emoticon.

$is_special

\BINARY

Whether this may only be used by privileged members

Edit a forum.

cns_edit_forum(\AUTO_LINK $forum_id, \SHORT_TEXT $name, \SHORT_TEXT $description, \AUTO_LINK $forum_grouping_id, \?AUTO_LINK $new_parent, integer $position, \BINARY $post_count_increment, \BINARY $order_sub_alpha, \LONG_TEXT $intro_question, \SHORT_TEXT $intro_answer, \SHORT_TEXT $redirection = '', \ID_TEXT $order = 'last_post', \BINARY $is_threaded = 0, boolean $reset_intro_acceptance = false
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum we are editing.

$name

\SHORT_TEXT

The name of the forum.

$description

\SHORT_TEXT

The description for the forum.

$forum_grouping_id

\AUTO_LINK

What forum grouping the forum will be filed with.

$new_parent

\?AUTO_LINK

The ID of the parent forum (null: this is the root forum).

$position

integer

The position of this forum relative to other forums viewable on the same screen (if parent forum hasn't specified automatic ordering).

$post_count_increment

\BINARY

Whether post counts will be incremented if members post in the forum.

$order_sub_alpha

\BINARY

Whether the ordering of subforums is done automatically, alphabetically).

$intro_question

\LONG_TEXT

The question that is shown for newbies to the forum (blank: none).

$intro_answer

\SHORT_TEXT

The answer to the question (blank: no specific answer.. if there's a 'question', it just requires a click-through).

$redirection

\SHORT_TEXT

Either blank for no redirection, the ID of another forum we are mirroring, or a URL to redirect to.

$order

\ID_TEXT

The order the topics are shown in, by default.

$is_threaded

\BINARY

Whether the forum is threaded.

$reset_intro_acceptance

boolean

Whether to force forum rules to be re-agreed to, if they've just been changed.

Edit a forum grouping.

cns_edit_forum_grouping(\AUTO_LINK $forum_grouping_id, \SHORT_TEXT $title, \SHORT_TEXT $description, \BINARY $expanded_by_default) 
package core_cns

Parameters

$forum_grouping_id

\AUTO_LINK

The ID of the forum grouping we are editing.

$title

\SHORT_TEXT

The title of the forum grouping.

$description

\SHORT_TEXT

The description of the forum grouping.

$expanded_by_default

\BINARY

Whether the forum grouping will be shown expanded by default (as opposed to contracted, where contained forums will not be shown until expansion).

Edit a usergroup.

cns_edit_group(\AUTO_LINK $group_id, \?SHORT_TEXT $name, \?BINARY $is_default, \?BINARY $is_super_admin, \?BINARY $is_super_moderator, \?SHORT_TEXT $title, \?URLPATH $rank_image, \?GROUP $promotion_target, \?integer $promotion_threshold, \?MEMBER $group_leader, \?integer $flood_control_submit_secs, \?integer $flood_control_access_secs, \?integer $max_daily_upload_mb, \?integer $max_attachments_per_post, \?integer $max_avatar_width, \?integer $max_avatar_height, \?integer $max_post_length_comcode, \?integer $max_sig_length_comcode, \?integer $gift_points_base, \?integer $gift_points_per_day, \?BINARY $enquire_on_new_ips, \?BINARY $is_presented_at_install, \?BINARY $hidden, \?integer $order, \?BINARY $rank_image_pri_only, \?BINARY $open_membership, \?BINARY $is_private_club, boolean $uniqify = false
package core_cns

Parameters

$group_id

\AUTO_LINK

The ID of the usergroup to edit.

$name

\?SHORT_TEXT

The name of the usergroup. (null: do not change)

$is_default

\?BINARY

Whether members are automatically put into the when they join. (null: do not change)

$is_super_admin

\?BINARY

Whether members of this usergroup are all super administrators. (null: do not change)

$is_super_moderator

\?BINARY

Whether members of this usergroup are all super moderators. (null: do not change)

$title

\?SHORT_TEXT

The title for primary members of this usergroup that don't have their own title. (null: do not change)

$rank_image

\?URLPATH

The rank image for this. (null: do not change)

$promotion_target

\?GROUP

The that members of this usergroup get promoted to at point threshold (null: no promotion prospects).

$promotion_threshold

\?integer

The point threshold for promotion (null: no promotion prospects).

$group_leader

\?MEMBER

The leader of this usergroup (null: none).

$flood_control_submit_secs

\?integer

The number of seconds that members of this usergroup must endure between submits (group 'best of' applies). (null: do not change)

$flood_control_access_secs

\?integer

The number of seconds that members of this usergroup must endure between accesses (group 'best of' applies). (null: do not change)

$max_daily_upload_mb

\?integer

The number of megabytes that members of this usergroup may attach per day (group 'best of' applies). (null: do not change)

$max_attachments_per_post

\?integer

The number of attachments that members of this usergroup may attach to something (group 'best of' applies). (null: do not change)

$max_avatar_width

\?integer

The maximum avatar width that members of this usergroup may have (group 'best of' applies). (null: do not change)

$max_avatar_height

\?integer

The maximum avatar height that members of this usergroup may have (group 'best of' applies). (null: do not change)

$max_post_length_comcode

\?integer

The maximum post length that members of this usergroup may make (group 'best of' applies). (null: do not change)

$max_sig_length_comcode

\?integer

The maximum signature length that members of this usergroup may make (group 'best of' applies). (null: do not change)

$gift_points_base

\?integer

The number of gift points that members of this usergroup start with (group 'best of' applies). (null: do not change)

$gift_points_per_day

\?integer

The number of gift points that members of this usergroup get per day (group 'best of' applies). (null: do not change)

$enquire_on_new_ips

\?BINARY

Whether e-mail confirmation is needed for new IP addresses seen for any member of this usergroup (group 'best of' applies). (null: do not change)

$is_presented_at_install

\?BINARY

Whether the is presented for joining at joining (implies anyone may be in the, but only choosable at joining) (null: do not change)

$hidden

\?BINARY

Whether the name and membership of the is hidden (null: do not change)

$order

\?integer

The display order this will be given, relative to other usergroups. Lower numbered usergroups display before higher numbered usergroups. (null: do not change)

$rank_image_pri_only

\?BINARY

Whether the rank image will not be shown for secondary membership (null: do not change)

$open_membership

\?BINARY

Whether members may join this usergroup without requiring any special permission (null: do not change)

$is_private_club

\?BINARY

Whether this usergroup is a private club. Private clubs may be managed in the CMS zone, and do not have any special permissions - except over their own associated forum. (null: do not change)

$uniqify

boolean

Whether to force the title as unique, if there's a conflict

Edit a member.

cns_edit_member(\AUTO_LINK $member_id, \?SHORT_TEXT $email_address, \?BINARY $preview_posts, \?integer $dob_day, \?integer $dob_month, \?integer $dob_year, \?ID_TEXT $timezone, \?GROUP $primary_group, array $custom_fields, \?ID_TEXT $theme, \?BINARY $reveal_age, \?BINARY $views_signatures, \?BINARY $auto_monitor_contrib_content, \?LANGUAGE_NAME $language, \?BINARY $allow_emails, \?BINARY $allow_emails_from_staff, \?BINARY $validated = null, \?string $username = null, \?string $password = null, \?BINARY $highlighted_name = null, \?SHORT_TEXT $pt_allow = '*', \?LONG_TEXT $pt_rules_text = '', \?TIME $on_probation_until = null, \?TIME $join_time = null, \?URLPATH $avatar_url = null, \?LONG_TEXT $signature = null, \?BINARY $is_perm_banned = null, \?URLPATH $photo_url = null, \?URLPATH $photo_thumb_url = null, \?SHORT_TEXT $salt = null, \?ID_TEXT $password_compatibility_scheme = null, boolean $skip_checks = false
package core_cns

Parameters

$member_id

\AUTO_LINK

The ID of the member.

$email_address

\?SHORT_TEXT

The e-mail address. (null: don't change)

$preview_posts

\?BINARY

Whether posts are previewed before they are made. (null: don't change)

$dob_day

\?integer

Day of date of birth. (null: don't change) (-1: deset)

$dob_month

\?integer

Month of date of birth. (null: don't change) (-1: deset)

$dob_year

\?integer

Year of date of birth. (null: don't change) (-1: deset)

$timezone

\?ID_TEXT

The member timezone. (null: don't change)

$primary_group

\?GROUP

The members primary (null: don't change).

$custom_fields

array

A map of custom fields values (field-id=>value).

$theme

\?ID_TEXT

The members default theme. (null: don't change)

$reveal_age

\?BINARY

Whether the members age may be shown. (null: don't change)

$views_signatures

\?BINARY

Whether the member sees signatures in posts. (null: don't change)

$auto_monitor_contrib_content

\?BINARY

Whether the member automatically is enabled for notifications for content they contribute to. (null: don't change)

$language

\?LANGUAGE_NAME

The members language. (null: don't change)

$allow_emails

\?BINARY

Whether the member allows e-mails via the site. (null: don't change)

$allow_emails_from_staff

\?BINARY

Whether the member allows e-mails from staff via the site. (null: don't change)

$validated

\?BINARY

Whether the profile has been validated (null: do not change this). (null: don't change)

$username

\?string

The username. (null: don't change)

$password

\?string

The password. (null: don't change)

$highlighted_name

\?BINARY

Whether the member username will be highlighted. (null: don't change)

$pt_allow

\?SHORT_TEXT

Usergroups that may PT the member. (null: don't change)

$pt_rules_text

\?LONG_TEXT

Rules that other members must agree to before they may start a PT with the member. (null: don't change)

$on_probation_until

\?TIME

When the member is on probation until (null: don't change)

$join_time

\?TIME

When the member joined (null: don't change)

$avatar_url

\?URLPATH

Avatar (null: don't change)

$signature

\?LONG_TEXT

Signature (null: don't change)

$is_perm_banned

\?BINARY

Banned status (null: don't change)

$photo_url

\?URLPATH

Photo URL (null: don't change)

$photo_thumb_url

\?URLPATH

URL of thumbnail of photo (null: don't change)

$salt

\?SHORT_TEXT

Password salt (null: don't change)

$password_compatibility_scheme

\?ID_TEXT

Password compatibility scheme (null: don't change)

$skip_checks

boolean

Whether to skip security checks and most of the change-triggered emails

Edit a multi moderation.

cns_edit_multi_moderation(\AUTO_LINK $id, \SHORT_TEXT $name, \LONG_TEXT $post_text, \?AUTO_LINK $move_to, \?BINARY $pin_state, \?BINARY $sink_state, \?BINARY $open_state, \SHORT_TEXT $forum_multi_code, \SHORT_TEXT $title_suffix) 
package core_cns

Parameters

$id

\AUTO_LINK

The ID of the multi moderation we are editing.

$name

\SHORT_TEXT

The name of the multi moderation.

$post_text

\LONG_TEXT

The default post text to add when applying (may be blank).

$move_to

\?AUTO_LINK

The forum to move the topic when applying (null: do not move).

$pin_state

\?BINARY

The pin state after applying (null: unchanged).

$sink_state

\?BINARY

The sink state after applying (null: unchanged).

$open_state

\?BINARY

The open state after applying (null: unchanged).

$forum_multi_code

\SHORT_TEXT

The forum multi code for where this multi moderation may be applied.

$title_suffix

\SHORT_TEXT

The title suffix.

Edit a forum poll.

cns_edit_poll(\AUTO_LINK $poll_id, \SHORT_TEXT $question, \BINARY $is_private, \BINARY $is_open, integer $minimum_selections, integer $maximum_selections, \BINARY $requires_reply, array $answers, \LONG_TEXT $reason = '') : \AUTO_LINK
package core_cns

Parameters

$poll_id

\AUTO_LINK

The ID of the poll we're editing.

$question

\SHORT_TEXT

The question.

$is_private

\BINARY

Whether the result tallies are kept private until the poll is made non-private.

$is_open

\BINARY

Whether the poll is open for voting.

$minimum_selections

integer

The minimum number of selections that may be made.

$maximum_selections

integer

The maximum number of selections that may be made.

$requires_reply

\BINARY

Whether members must have a post in the topic before they made vote.

$answers

array

A list of the potential voteable answers.

$reason

\LONG_TEXT

The reason for editing the poll.

Returns

\AUTO_LINKThe ID of the topic the poll is on.

Edit a post.

cns_edit_post(\AUTO_LINK $post_id, \BINARY $validated, \SHORT_TEXT $title, \LONG_TEXT $post, \BINARY $skip_sig, \BINARY $is_emphasised, \?MEMBER $intended_solely_for, boolean $show_as_edited, boolean $mark_as_unread, \LONG_TEXT $reason, boolean $check_perms = true, \?TIME $edit_time = null, \?TIME $add_time = null, \?MEMBER $submitter = null, boolean $null_is_literal = false, boolean $run_checks = true) : \AUTO_LINK
package core_cns

Parameters

$post_id

\AUTO_LINK

The ID of the post that we're editing.

$validated

\BINARY

Whether the post is validated (null: decide based on permissions).

$title

\SHORT_TEXT

The title of the post (may be blank).

$post

\LONG_TEXT

The post.

$skip_sig

\BINARY

Whether to skip showing the posters signature in the post.

$is_emphasised

\BINARY

Whether the post is marked emphasised.

$intended_solely_for

\?MEMBER

The member that this post is intended solely for (null: none).

$show_as_edited

boolean

Whether to show the post as edited.

$mark_as_unread

boolean

Whether to mark the topic as unread by those previous having read this post.

$reason

\LONG_TEXT

The reason for this action.

$check_perms

boolean

Whether to check permissions.

$edit_time

\?TIME

Edit time (null: either means current time, or if $null_is_literal, means reset to to NULL)

$add_time

\?TIME

Add time (null: do not change)

$submitter

\?MEMBER

Submitter (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'

$run_checks

boolean

Whether to run checks

Returns

\AUTO_LINKThe ID of the topic (whilst this could be known without calling this function, as we've gone to effort and grabbed it from the DB, it might turn out useful for something).

Edit a post template.

cns_edit_post_template(\AUTO_LINK $id, \SHORT_TEXT $title, \LONG_TEXT $text, \SHORT_TEXT $forum_multi_code, \BINARY $use_default_forums) 
package core_cns

Parameters

$id

\AUTO_LINK

The ID of the post template to edit.

$title

\SHORT_TEXT

The title for the template.

$text

\LONG_TEXT

The text of the template.

$forum_multi_code

\SHORT_TEXT

The multi code specifying which forums this is applicable in.

$use_default_forums

\BINARY

Whether to use this as the default post in applicable forum.

Edit a topic.

cns_edit_topic(\?AUTO_LINK $topic_id, \?SHORT_TEXT $description = null, \?SHORT_TEXT $emoticon = null, \?BINARY $validated = null, \?BINARY $open = null, \?BINARY $pinned = null, \?BINARY $sunk = null, \?BINARY $cascading = null, \LONG_TEXT $reason = '', \?string $title = null, \?SHORT_TEXT $description_link = null, boolean $check_perms = true, \?integer $views = null, boolean $null_is_literal = false
package core_cns

Parameters

$topic_id

\?AUTO_LINK

The ID of the topic to edit (null: Private Topic).

$description

\?SHORT_TEXT

Description of the topic (null: do not change).

$emoticon

\?SHORT_TEXT

The image code of the emoticon for the topic (null: do not change).

$validated

\?BINARY

Whether the topic is validated (null: do not change).

$open

\?BINARY

Whether the topic is open (null: do not change).

$pinned

\?BINARY

Whether the topic is pinned (null: do not change).

$sunk

\?BINARY

Whether the topic is sunk (null: do not change).

$cascading

\?BINARY

Whether the topic is cascading (null: do not change).

$reason

\LONG_TEXT

The reason for this action.

$title

\?string

New title for the topic (null: do not change).

$description_link

\?SHORT_TEXT

Link related to the topic (e.g. link to view a ticket) (null: do not change).

$check_perms

boolean

Whether to check permissions.

$views

\?integer

Number of views (null: do not change)

$null_is_literal

boolean

Determines whether some NULLs passed mean 'use a default' or literally mean 'set to NULL'

Edit a formal warning.

cns_edit_warning(\AUTO_LINK $warning_id, \LONG_TEXT $explanation, \BINARY $is_warning = 1) : \AUTO_LINK
package core_cns

Parameters

$warning_id

\AUTO_LINK

The ID of the formal warning we are editing.

$explanation

\LONG_TEXT

An explanation for why the member is being warned.

$is_warning

\BINARY

Whether this counts as a warning

Returns

\AUTO_LINKThe member ID the warning was for.

Edit a Welcome E-mail.

cns_edit_welcome_email(\AUTO_LINK $id, \SHORT_TEXT $name, \SHORT_TEXT $subject, \LONG_TEXT $text, integer $send_time, \?AUTO_LINK $newsletter, \?AUTO_LINK $usergroup, \ID_TEXT $usergroup_type) 
package core_cns
set primary secondary

Parameters

$id

\AUTO_LINK

The ID

$name

\SHORT_TEXT

A name for the Welcome E-mail

$subject

\SHORT_TEXT

The subject of the Welcome E-mail

$text

\LONG_TEXT

The message body of the Welcome E-mail

$send_time

integer

The number of hours before sending the e-mail

$newsletter

\?AUTO_LINK

What newsletter to send out to instead of members (null: none)

$usergroup

\?AUTO_LINK

The usergroup to tie to (null: none)

$usergroup_type

\ID_TEXT

How to send regarding usergroups (blank: indiscriminately)

Bomb out if the specified forum doesn't exist.

cns_ensure_forum_exists(\AUTO_LINK $forum_id) : \SHORT_TEXT
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum.

Returns

\SHORT_TEXTThe name of the forum.

Bomb out if the specified forum grouping doesn't exist.

cns_ensure_forum_grouping_exists(\AUTO_LINK $forum_grouping_id) 
package core_cns

Parameters

$forum_grouping_id

\AUTO_LINK

The ID of the forum grouping.

Ensure a list of usergroups are cached in memory.

cns_ensure_groups_cached(mixed $groups) 
package core_cns

Parameters

$groups

mixed

The list of usergroups (array) or '*'.

Find is a field is editable.

cns_field_editable(\ID_TEXT $field_name, \ID_TEXT $special_type) : boolean

Called for fields that have a fair chance of being set to auto-sync, and hence be locked to local edits.

package core_cns

Parameters

$field_name

\ID_TEXT

Field name

$special_type

\ID_TEXT

The special type of the user (built-in types are: , ldap, httpauth, )

Returns

booleanWhether the field is editable

Find all the birthdays in a certain day.

cns_find_birthdays(\?TIME $time = null) : array
package core_cns

Parameters

$time

\?TIME

A timestamps that exists in the certain day (null: now).

Returns

arrayList of maps describing the members whose birthday it is on the certain day.

Update a forums cached details.

cns_force_update_forum_caching(\AUTO_LINK $forum_id, \?integer $num_topics_increment = null, \?integer $num_posts_increment = null, \?AUTO_LINK $last_topic_id = null, \?string $last_title = null, \?TIME $last_time = null, \?string $last_username = null, \?MEMBER $last_member_id = null, \?AUTO_LINK $last_forum_id = null
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum to update the cached details of.

$num_topics_increment

\?integer

How much to increment the topic count by (null: It has to be completely recalculated).

$num_posts_increment

\?integer

How much to increment the post count by (null: It has to be completely recalculated).

$last_topic_id

\?AUTO_LINK

The ID of the last topic (null: Unknown, it will have to be looked up).

$last_title

\?string

The title of the last topic (null: Unknown, it will have to be looked up).

$last_time

\?TIME

The last post time of the last topic (null: Unknown, it will have to be looked up).

$last_username

\?string

The last post username of the last topic (null: Unknown, it will have to be looked up).

$last_member_id

\?MEMBER

The last post member of the last topic (null: Unknown, it will have to be looked up).

$last_forum_id

\?AUTO_LINK

The forum the last post was in (note this makes sense, because there may be subforums under this forum that we have to take into account). (null: Unknown, it will have to be looked up).

Force a members post count to be recalculated.

cns_force_update_member_post_count(\MEMBER $member_id, \?integer $member_post_count_dif = null
package core_cns

Parameters

$member_id

\MEMBER

The member.

$member_post_count_dif

\?integer

The amount to add to the post count (null: fully recalculate the post count).

Update a topic's caching.

cns_force_update_topic_caching(\AUTO_LINK $topic_id, \?integer $post_count_dif = null, boolean $last = true, boolean $first = false, \?AUTO_LINK $last_post_id = null, \?TIME $last_time = null, \?string $last_title = null, \?AUTO_LINK $last_post = null, \?string $last_username = null, \?MEMBER $last_member_id = null
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic to update caching of.

$post_count_dif

\?integer

The post count difference we know the topic has undergone (null: we'll need to work out from scratch how many posts are in the topic)

$last

boolean

Whether this is the latest post in the topic.

$first

boolean

Whether this is the first post in the topic.

$last_post_id

\?AUTO_LINK

The ID of the last post in the topic (null: unknown).

$last_time

\?TIME

The time of the last post in the topic (null: unknown).

$last_title

\?string

The title of the last post in the topic (null: unknown).

$last_post

\?AUTO_LINK

The ID of the last posts language string for the topic (null: unknown).

$last_username

\?string

The last username to post in the topic (null: unknown).

$last_member_id

\?MEMBER

The ID of the last member to post in the topic (null: unknown).

Get breadcrumbs for a forum.

cns_forum_breadcrumbs(mixed $end_point_forum, \?mixed $this_name = null, \?AUTO_LINK $parent_forum = null, boolean $start = true, \?AUTO_LINK $root = null) : \Tempcode: array
package core_cns

Parameters

$end_point_forum

mixed

The ID of the forum we are at in our path (null: end of recursion) (false: no forum ID available, this_name and parent_forum must not be NULL).

$this_name

\?mixed

The name of the given forum as string or Tempcode (null: find it from the DB).

$parent_forum

\?AUTO_LINK

The parent forum of the given forum (null: find it from the DB).

$start

boolean

Whether this is being called as the recursion start of deriving the breadcrumbs (top level call).

$root

\?AUTO_LINK

Virtual root (null: none).

Returns

\TempcodeThe breadcrumbs.
arrayThe breadcrumbs.

Gets all the system custom fields that match certain parameters.

cns_get_all_custom_fields_match(\?array $groups = null, \?BINARY $public_view = null, \?BINARY $owner_view = null, \?BINARY $owner_set = null, \?BINARY $required = null, \?BINARY $show_in_posts = null, \?BINARY $show_in_post_previews = null, \BINARY $special_start = 0, \?boolean $show_on_join_form = null) : array
package core_cns

Parameters

$groups

\?array

That are applicable only to one of the usergroups in this list (empty: CPFs with no restriction) (null: disregard restriction).

$public_view

\?BINARY

That are publicly viewable (null: don't care).

$owner_view

\?BINARY

That are owner viewable (null: don't care).

$owner_set

\?BINARY

That are owner settable (null: don't care).

$required

\?BINARY

That are required (null: don't care).

$show_in_posts

\?BINARY

That are to be shown in posts (null: don't care).

$show_in_post_previews

\?BINARY

That are to be shown in post previews (null: don't care).

$special_start

\BINARY

That start 'cms_'

$show_on_join_form

\?boolean

That are to go on the join form (null: don't care).

Returns

arrayA list of rows of such fields.

Gets all a member's custom fields that match certain parameters.

cns_get_all_custom_fields_match_member(\MEMBER $member_id, \?BINARY $public_view = null, \?BINARY $owner_view = null, \?BINARY $owner_set = null, \?BINARY $encrypted = null, \?BINARY $required = null, \?BINARY $show_in_posts = null, \?BINARY $show_in_post_previews = null, \BINARY $special_start = 0, \?boolean $show_on_join_form = null) : array
package core_cns

Parameters

$member_id

\MEMBER

The member.

$public_view

\?BINARY

That are publicly viewable (null: don't care).

$owner_view

\?BINARY

That are owner viewable (null: don't care).

$owner_set

\?BINARY

That are owner settable (null: don't care).

$encrypted

\?BINARY

That are encrypted (null: don't care).

$required

\?BINARY

That are required (null: don't care).

$show_in_posts

\?BINARY

That are to be shown in posts (null: don't care).

$show_in_post_previews

\?BINARY

That are to be shown in post previews (null: don't care).

$special_start

\BINARY

That start 'cms_'

$show_on_join_form

\?boolean

That are to go on the join form (null: don't care).

Returns

arrayA mapping of field title to a map of details: 'RAW' as the raw field value, 'RENDERED' as the rendered field value, 'FIELD_ID' to the field ID, 'EDITABILITY' defining if fractional editing can work on this

Get a list of the default usergroups (the usergroups a member is put in when they join).

cns_get_all_default_groups(boolean $include_primary = false, boolean $include_all_configured_default_groups = false) : array
package core_cns

Parameters

$include_primary

boolean

Whether to include the default primary (at the end of the list).

$include_all_configured_default_groups

boolean

The functionality does not usually consider configured default groups [unless there's just one], because this is a layer of uncertainity (the user PICKS one of these). If you want to return all configured default groups, set this parameter to true.

Returns

arrayThe list of default IDs.

Gets a list of subordinate forums of a certain forum.

cns_get_all_subordinate_forums(\AUTO_LINK $forum_id, \?string $create_or_list = null, \?array $tree = null, boolean $ignore_permissions = false) : mixed
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum we are finding subordinate forums of.

$create_or_list

\?string

The field name to use in the OR list (null: do not make an OR list, return an array).

$tree

\?array

The forum tree structure (null: unknown, it will be found using cns_organise_into_tree).

$ignore_permissions

boolean

Whether to ignore permissions in this.

Returns

mixedThe list (is either a true list, or an OR list).

Get the best value of all values of a property for a list of usergroups.

cns_get_best_group_property(array $groups, \ID_TEXT $property) : mixed
package core_cns

Parameters

$groups

array

The list of usergroups.

$property

\ID_TEXT

The identifier of the property.

Returns

mixedThe best property value ('best' is dependant on the property we are looking at).

Returns a list of all field values for user. Doesn't take translation into account. Doesn't take anything permissive into account.

cns_get_custom_field_mappings(\MEMBER $member_id) : array
package core_cns

Parameters

$member_id

\MEMBER

The member.

Returns

arrayThe mapping, field_ to value.

Returns a mapping between field number and field value. Doesn't take translation into account. Doesn't take anything permissive into account.

cns_get_custom_fields_member(\MEMBER $member_id) : array
package core_cns

Parameters

$member_id

\MEMBER

The member.

Returns

arrayThe mapping.

Find all the Private Topic filter categories employed by the current member.

cns_get_filter_cats(boolean $only_exists_now = false) : array
package core_cns

Parameters

$only_exists_now

boolean

Whether to only show ones that already have things in (i.e. not default ones)

Returns

arrayList of filter categories

Get a form field for editing a forum multi code, set up with a default of the given forum multi code.

cns_get_forum_multi_code_field(\SHORT_TEXT $forum_multi_code) : \Tempcode
package core_cns

Parameters

$forum_multi_code

\SHORT_TEXT

The multi code.

Returns

\TempcodeThe form field.

Get an OR list of a forums parents, suited for selection from the f_topics table.

cns_get_forum_parent_or_list(\AUTO_LINK $forum_id, \?AUTO_LINK $parent_id = -1) : string
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum.

$parent_id

\?AUTO_LINK

The ID of the parent forum (-1: get it from the DB) (null: there is no parent, as it is the root forum).

Returns

stringThe OR list.

Generate a map of details for choosing a forum. Also capable of getting comma-separated ancester forum lists.

cns_get_forum_tree(\?MEMBER $member_id = null, \?AUTO_LINK $base_forum = null, string $breadcrumbs = '', \?AUTO_LINK $skip = null, \?array $forum_details = null, boolean $use_compound_list = false, \?integer $levels = null, boolean $do_stats = false, \?TIME $updated_since = null) : array
package core_cns

Parameters

$member_id

\?MEMBER

The member that the view privileges are done for (null: current member).

$base_forum

\?AUTO_LINK

The forum we are starting from (null: capture the whole tree).

$breadcrumbs

string

The breadcrumbs at this point of the recursion (blank for the start).

$skip

\?AUTO_LINK

ID of a forum to skip display/recursion for (null: none).

$forum_details

\?array

Details of the current forum in the recursion (null: find from DB).

$use_compound_list

boolean

Whether to generate a compound list (a list of all the ancesters, for each point in the forum tree) as well as the tree.

$levels

\?integer

The number of recursive levels to search (null: all)

$do_stats

boolean

Whether to generate tree statistics.

$updated_since

\?TIME

Time from which content must be updated (null: no limit).

Returns

arrayA list of maps, OR (if $use_compound_list) a pair of the Tempcode and the compound list.

Get some forum stats.

cns_get_forums_stats() : array
package core_cns

Returns

arrayA map of forum stats.

Get a list of members in a (or more full details if $non_validated is true).

cns_get_group_members_raw(\GROUP $group_id, boolean $include_primaries = true, boolean $non_validated = false, boolean $include_secondaries = true, boolean $include_unvalidated_members = true, \?integer $max = null, integer $start = 0) : array
package core_cns

Parameters

$group_id

\GROUP

The ID of the group.

$include_primaries

boolean

Whether to include those in the as a primary member.

$non_validated

boolean

Whether to include those applied to join the, but not validated in (also causes it to return maps that contain this info).

$include_secondaries

boolean

Whether to include those in the as a secondary member.

$include_unvalidated_members

boolean

Whether to include those members who are not validated as site members at all yet (parameter currently ignored).

$max

\?integer

Return up to this many entries for primary members and this many entries for secondary members and all LDAP members (null: no limit, only use no limit if querying very restricted usergroups!)

$start

integer

Return primary members after this offset and secondary members after this offset

Returns

arrayThe list.

Get a count of members in a (or more full details if $non_validated is true).

cns_get_group_members_raw_count(\GROUP $group_id, boolean $include_primaries = true, boolean $non_validated = false, boolean $include_secondaries = true, boolean $include_unvalidated_members = true) : integer
package core_cns

Parameters

$group_id

\GROUP

The ID of the group.

$include_primaries

boolean

Whether to include those in the as a primary member.

$non_validated

boolean

Whether to include those applied to join the, but not validated in.

$include_secondaries

boolean

Whether to include those in the as a secondary member.

$include_unvalidated_members

boolean

Whether to include those members who are not validated as site members at all yet (parameter currently ignored).

Returns

integerThe count.

Get a usergroup name.

cns_get_group_name(\GROUP $group, boolean $hide_hidden = true) : string
package core_cns

Parameters

$group

\GROUP

The ID of the group.

$hide_hidden

boolean

Whether to hide the name if it is a hidden group.

Returns

stringThe usergroup name.

Get a certain property of a certain.

cns_get_group_property(\GROUP $group, \ID_TEXT $property, boolean $hide_hidden = true) : mixed
package core_cns

Parameters

$group

\GROUP

The ID of the group.

$property

\ID_TEXT

The identifier of the property.

$hide_hidden

boolean

Whether to hide the name if it is a hidden group.

Returns

mixedThe property value.

Get the best value of all values of a property for a member (due to members being in multiple usergroups).

cns_get_member_best_group_property(\MEMBER $member_id, \ID_TEXT $property) : mixed
package core_cns

Parameters

$member_id

\MEMBER

The ID of the member.

$property

\ID_TEXT

The identifier of the property.

Returns

mixedThe property value.

Get form fields for adding/editing/finishing a member profile.

cns_get_member_fields(boolean $mini_mode = true, \?MEMBER $member_id = null, \?array $groups = null, \SHORT_TEXT $email_address = '', \BINARY $preview_posts = 0, \?integer $dob_day = null, \?integer $dob_month = null, \?integer $dob_year = null, \?ID_TEXT $timezone = null, \?array $custom_fields = null, \?ID_TEXT $theme = null, \BINARY $reveal_age = 1, \BINARY $views_signatures = 1, \?BINARY $auto_monitor_contrib_content = null, \?LANGUAGE_NAME $language = null, \BINARY $allow_emails = 1, \BINARY $allow_emails_from_staff = 1, \BINARY $validated = 1, \?GROUP $primary_group = null, \SHORT_TEXT $username = '', \BINARY $is_perm_banned = 0, \ID_TEXT $special_type = '', \BINARY $highlighted_name = 0, \SHORT_TEXT $pt_allow = '*', \LONG_TEXT $pt_rules_text = '', \?TIME $on_probation_until = null) : array
package core_cns

Parameters

$mini_mode

boolean

Whether we are only handling the essential details of a profile.

$member_id

\?MEMBER

The ID of the member we are handling (null: new member).

$groups

\?array

A list of usergroups (null: default/current usergroups).

$email_address

\SHORT_TEXT

The e-mail address.

$preview_posts

\BINARY

Whether posts are previewed before they are made.

$dob_day

\?integer

Day of date of birth (null: not known).

$dob_month

\?integer

Month of date of birth (null: not known).

$dob_year

\?integer

Year of date of birth (null: not known).

$timezone

\?ID_TEXT

The member timezone (null: site default).

$custom_fields

\?array

A map of custom fields values (field-id=>value) (null: not known).

$theme

\?ID_TEXT

The members default theme (null: not known).

$reveal_age

\BINARY

Whether the members age may be shown.

$views_signatures

\BINARY

Whether the member sees signatures in posts.

$auto_monitor_contrib_content

\?BINARY

Whether the member automatically is enabled for notifications for content they contribute to (null: get default from config).

$language

\?LANGUAGE_NAME

The members language (null: auto detect).

$allow_emails

\BINARY

Whether the member allows e-mails via the site.

$allow_emails_from_staff

\BINARY

Whether the member allows e-mails from staff via the site.

$validated

\BINARY

Whether the profile has been validated.

$primary_group

\?GROUP

The members primary (null: not known).

$username

\SHORT_TEXT

The username.

$is_perm_banned

\BINARY

Whether the member is permanently banned.

$special_type

\ID_TEXT

The special type of profile this is (blank: not a special type).

$highlighted_name

\BINARY

Whether the member username will be highlighted.

$pt_allow

\SHORT_TEXT

Usergroups that may PT the member.

$pt_rules_text

\LONG_TEXT

Rules that other members must agree to before they may start a PT with the member.

$on_probation_until

\?TIME

When the member is on probation until (null: just finished probation / or effectively was never on it)

Returns

arrayA pair: The form fields, Hidden fields (both Tempcode).

Get form fields for adding/editing/finishing a member profile.

cns_get_member_fields_profile(boolean $mini_mode = true, \?MEMBER $member_id = null, \?array $groups = null, \?array $custom_fields = null) : array
package core_cns

Parameters

$mini_mode

boolean

Whether we are only handling the essential details of a profile.

$member_id

\?MEMBER

The ID of the member we are handling (null: new member).

$groups

\?array

A list of usergroups (null: default/current usergroups).

$custom_fields

\?array

A map of custom fields values (field-id=>value) (null: not known).

Returns

arrayA pair: The form fields, Hidden fields (both Tempcode).

Get form fields for adding/editing/finishing a member profile.

cns_get_member_fields_settings(boolean $mini_mode = true, \?MEMBER $member_id = null, \?array $groups = null, \SHORT_TEXT $email_address = '', \?BINARY $preview_posts = null, \?integer $dob_day = null, \?integer $dob_month = null, \?integer $dob_year = null, \?ID_TEXT $timezone = null, \?ID_TEXT $theme = null, \BINARY $reveal_age = 1, \BINARY $views_signatures = 1, \?BINARY $auto_monitor_contrib_content = null, \?LANGUAGE_NAME $language = null, \BINARY $allow_emails = 1, \BINARY $allow_emails_from_staff = 1, \BINARY $validated = 1, \?GROUP $primary_group = null, \SHORT_TEXT $username = '', \BINARY $is_perm_banned = 0, \ID_TEXT $special_type = '', \BINARY $highlighted_name = 0, \SHORT_TEXT $pt_allow = '*', \LONG_TEXT $pt_rules_text = '', \?TIME $on_probation_until = null) : array
package core_cns

Parameters

$mini_mode

boolean

Whether we are only handling the essential details of a profile.

$member_id

\?MEMBER

The ID of the member we are handling (null: new member).

$groups

\?array

A list of usergroups (null: default/current usergroups).

$email_address

\SHORT_TEXT

The e-mail address.

$preview_posts

\?BINARY

Whether posts are previewed before they are made (null: calculate statistically).

$dob_day

\?integer

Day of date of birth (null: not known).

$dob_month

\?integer

Month of date of birth (null: not known).

$dob_year

\?integer

Year of date of birth (null: not known).

$timezone

\?ID_TEXT

The member timezone (null: site default).

$theme

\?ID_TEXT

The members default theme (null: not known).

$reveal_age

\BINARY

Whether the members age may be shown.

$views_signatures

\BINARY

Whether the member sees signatures in posts.

$auto_monitor_contrib_content

\?BINARY

Whether the member automatically is enabled for notifications for content they contribute to (null: get default from config).

$language

\?LANGUAGE_NAME

The members language (null: auto detect).

$allow_emails

\BINARY

Whether the member allows e-mails via the site.

$allow_emails_from_staff

\BINARY

Whether the member allows e-mails from staff via the site.

$validated

\BINARY

Whether the profile has been validated.

$primary_group

\?GROUP

The members primary (null: not known).

$username

\SHORT_TEXT

The username.

$is_perm_banned

\BINARY

Whether the member is permanently banned.

$special_type

\ID_TEXT

The special type of profile this is (blank: not a special type).

$highlighted_name

\BINARY

Whether the member username will be highlighted.

$pt_allow

\SHORT_TEXT

Usergroups that may PT the member.

$pt_rules_text

\LONG_TEXT

Rules that other members must agree to before they may start a PT with the member.

$on_probation_until

\?TIME

When the member is on probation until (null: just finished probation / or effectively was never on it)

Returns

arrayA pair: The form fields, Hidden fields (both Tempcode).

Get the primary of a member (supports consulting of LDAP).

cns_get_member_primary_group(\MEMBER $member_id) : \GROUP
package core_cns

Parameters

$member_id

\MEMBER

The member.

Returns

\GROUPThe primary.

Get a list of the usergroups a member is in (keys say the usergroups, values are irrelevant).

cns_get_members_groups(\?MEMBER $member_id = null, boolean $skip_secret = false, boolean $handle_probation = true, boolean $include_implicit = true) : array
package core_cns

Parameters

$member_id

\?MEMBER

The member to find the usergroups of (null: current member).

$skip_secret

boolean

Whether to skip looking at secret usergroups.

$handle_probation

boolean

Whether to take probation into account

$include_implicit

boolean

Whether to include implicit groups

Returns

arrayReverse list (e.g. array(1=>true,2=>true,3=>true) for someone in (1,2,3)).

Get a list of post templates that apply to a certain forum.

cns_get_post_templates(\AUTO_LINK $forum_id) : array
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum.

Returns

arrayThe list of applicable post templates.

Get the personal post rows for the current member.

cns_get_pp_rows(\?integer $limit = 5, boolean $unread = true, boolean $include_inline = true, \?TIME $time_barrier = null) : array
package core_cns

Parameters

$limit

\?integer

The maximum number of rows to get (gets newest first) (null: no limit).

$unread

boolean

Whether to only get unread ones.

$include_inline

boolean

Whether to include inline personal posts.

$time_barrier

\?TIME

Only since this date (null: no limit).

Returns

arrayThe personal post rows (with corresponding topic details).

Get the poster name a Guest may have specified, after sanitising it.

cns_get_safe_specified_poster_name(boolean $is_required_field = null) : string
package core_cns

Parameters

$is_required_field

boolean

If it is a required field (null: typically no, but look at hidden option for it).

Returns

stringPoster name.

Get a list of maps containing all the topics, and path information, under the specified forum - and those beneath it, recursively.

cns_get_topic_tree(\?AUTO_LINK $forum_id = null, \?string $breadcrumbs = null, \?ID_TEXT $title = null, \?integer $levels = null) : array
package core_cns

Parameters

$forum_id

\?AUTO_LINK

The forum being at the root of our recursion (null: true root forum)

$breadcrumbs

\?string

The breadcrumbs up to this point in the recursion (null: blank, as we are starting the recursion)

$title

\?ID_TEXT

The forum name of the $forum_id we are currently going through (null: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the childs title

$levels

\?integer

The number of recursive levels to search (null: all)

Returns

arrayA list of maps for all forums. Each map entry containins the fields 'id' (forum ID) and 'breadcrumbs' (path to the forum, including the forums own title), and more.

Get an SQL 'WHERE' clause for the posts in a topic.

cns_get_topic_where(\AUTO_LINK $topic_id, \?MEMBER $member_id = null) : string
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic we are getting details of.

$member_id

\?MEMBER

The member doing the lookup (null: current member).

Returns

stringThe WHERE clause.

Get all the warning rows for a certain member.

cns_get_warnings(\MEMBER $member_id) : array
package core_cns

Parameters

$member_id

\MEMBER

The member.

Returns

arrayThe warning rows.

Copy permissions relating to one, to another.

cns_group_absorb_privileges_of(\GROUP $to, \GROUP $from) 
package core_cns

Parameters

$to

\GROUP

The that is having it's permissions replaced.

$from

\GROUP

The that the permissions are being drawn from.

Find whether a member has read a certain topic, such that they have possibly read all posts within it already.

cns_has_read_topic(\AUTO_LINK $topic_id, \?TIME $topic_last_time = null, \?MEMBER $member_id = null, \?TIME $member_last_time = null) : boolean
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic.

$topic_last_time

\?TIME

The time of the last post in the topic (null: get it from the DB).

$member_id

\?MEMBER

The member (null: current member).

$member_last_time

\?TIME

The time the member last viewed the topic (null: get it from the DB).

Returns

booleanThey have read it as such, yes.

Find whether a member has replied to a certain topic.

cns_has_replied_topic(\AUTO_LINK $topic_id, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$topic_id

\AUTO_LINK

The topic.

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanThe answer.

Find whether a member has special access to a certain PT.

cns_has_special_pt_access(\AUTO_LINK $topic_id, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic.

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanWhether they have special access.

Invite a member to a PT.

cns_invite_to_pt(\MEMBER $member_id, \AUTO_LINK $topic_id) 
package core_cns

Parameters

$member_id

\MEMBER

Member getting access

$topic_id

\AUTO_LINK

The topic

Find whether a member is bound to HTTP authentication (an exceptional situation, only for sites that use it).

cns_is_httpauth_member(\MEMBER $member_id) : boolean
package core_cns

Parameters

$member_id

\MEMBER

The member.

Returns

booleanThe answer.

Find whether a member is bound to HTTP LDAP (an exceptional situation, only for sites that use it).

cns_is_ldap_member(\MEMBER $member_id) : boolean
package core_cns

Parameters

$member_id

\MEMBER

The member.

Returns

booleanThe answer.

Actualise the join form.

cns_join_actual(boolean $captcha_if_enabled = true, boolean $intro_message_if_enabled = true, boolean $invites_if_enabled = true, boolean $one_per_email_address_if_enabled = true, boolean $confirm_if_enabled = true, boolean $validate_if_enabled = true, boolean $coppa_if_enabled = true, boolean $instant_login = true, \?ID_TEXT $username = null, \?EMAIL $email_address = null, \?string $password = null, \?array $actual_custom_fields = null) : array
package core_cns

Parameters

$captcha_if_enabled

boolean

Whether to handle CAPTCHA (if enabled at all)

$intro_message_if_enabled

boolean

Whether to ask for intro messages (if enabled at all)

$invites_if_enabled

boolean

Whether to check for invites (if enabled at all)

$one_per_email_address_if_enabled

boolean

Whether to check email-address restrictions (if enabled at all)

$confirm_if_enabled

boolean

Whether to require staff confirmation (if enabled at all)

$validate_if_enabled

boolean

Whether to force email address validation (if enabled at all)

$coppa_if_enabled

boolean

Whether to do COPPA checks (if enabled at all)

$instant_login

boolean

Whether to instantly log the user in

$username

\?ID_TEXT

Username (null: read from environment)

$email_address

\?EMAIL

E-mail address (null: read from environment)

$password

\?string

Password (null: read from environment)

$actual_custom_fields

\?array

Custom fields to save (null: read from environment)

Returns

arrayA tuple: Messages to show, member ID of new member

Get the join form.

cns_join_form(\Tempcode $url, boolean $captcha_if_enabled = true, boolean $intro_message_if_enabled = true, boolean $invites_if_enabled = true, boolean $one_per_email_address_if_enabled = true) : array
package core_cns

Parameters

$url

\Tempcode

URL to direct to

$captcha_if_enabled

boolean

Whether to handle CAPTCHA (if enabled at all)

$intro_message_if_enabled

boolean

Whether to ask for intro messages (if enabled at all)

$invites_if_enabled

boolean

Whether to check for invites (if enabled at all)

$one_per_email_address_if_enabled

boolean

Whether to check email-address restrictions (if enabled at all)

Returns

arrayA tuple: Necessary JavaScript code, the form

List all the multi moderations that may be used in a certain forum.

cns_list_multi_moderations(\AUTO_LINK $forum_id) : array
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum we are listing for.

Returns

arrayList of multi moderations.

Make a custom profile field from one of the predefined templates (this is often used by importers).

cns_make_boiler_custom_field(\ID_TEXT $type) : \AUTO_LINK
package core_cns

Parameters

$type

\ID_TEXT

The identifier of the boiler custom profile field.

Returns

\AUTO_LINKThe ID of the new custom profile field.

Make a custom profile field.

cns_make_custom_field(\SHORT_TEXT $name, \BINARY $locked = 0, \SHORT_TEXT $description = '', \LONG_TEXT $default = '', \BINARY $public_view = 0, \BINARY $owner_view = 0, \BINARY $owner_set = 0, \BINARY $encrypted = 0, \ID_TEXT $type = 'long_text', \BINARY $required = 0, \BINARY $show_in_posts = 0, \BINARY $show_in_post_previews = 0, \?integer $order = null, \LONG_TEXT $only_group = '', \BINARY $show_on_join_form = 0, \SHORT_TEXT $options = '', boolean $no_name_dupe = false) : \AUTO_LINK
package core_cns
set short_text long_text short_trans long_trans integer upload picture url list tick float

Parameters

$name

\SHORT_TEXT

Name of the field.

$locked

\BINARY

Whether the field is locked (i.e. cannot be deleted from the system).

$description

\SHORT_TEXT

Description of the field.

$default

\LONG_TEXT

The default value for the field.

$public_view

\BINARY

Whether the field is publicly viewable.

$owner_view

\BINARY

Whether the field is viewable by the owner.

$owner_set

\BINARY

Whether the field may be set by the owner.

$encrypted

\BINARY

Whether the field is encrypted.

$type

\ID_TEXT

The type of the field.

$required

\BINARY

Whether it is required that every member have this field filled in.

$show_in_posts

\BINARY

Whether this field is shown in posts and places where member details are highlighted (such as an image in a member gallery).

$show_in_post_previews

\BINARY

Whether this field is shown in preview places, such as in the forum member tooltip.

$order

\?integer

The order of this field relative to other fields (null: next).

$only_group

\LONG_TEXT

The usergroups that this field is confined to (comma-separated list).

$show_on_join_form

\BINARY

Whether the field is to be shown on the join form

$options

\SHORT_TEXT

Field options

$no_name_dupe

boolean

Whether to check that no field has this name already.

Returns

\AUTO_LINKThe ID of the new custom profile field.

Make an emoticon.

cns_make_emoticon(\SHORT_TEXT $code, \ID_TEXT $theme_img_code, integer $relevance_level = 1, \BINARY $use_topics = 1, \BINARY $is_special = 0
package core_cns
range 0 4

Parameters

$code

\SHORT_TEXT

The textual code entered to make the emoticon appear.

$theme_img_code

\ID_TEXT

The image code used for the emoticon.

$relevance_level

integer

The relevance level. 0 is core, shown immediately.

$use_topics

\BINARY

Whether this may be used as a topic emoticon.

$is_special

\BINARY

Whether this may only be used by privileged members

Make a forum.

cns_make_forum(\SHORT_TEXT $name, \SHORT_TEXT $description, \?AUTO_LINK $forum_grouping_id, \?array $access_mapping, \?AUTO_LINK $parent_forum, integer $position = 1, \BINARY $post_count_increment = 1, \BINARY $order_sub_alpha = 0, \LONG_TEXT $intro_question = '', \SHORT_TEXT $intro_answer = '', \SHORT_TEXT $redirection = '', \ID_TEXT $order = 'last_post', \BINARY $is_threaded = 0) : \AUTO_LINK
package core_cns

Parameters

$name

\SHORT_TEXT

The name of the forum.

$description

\SHORT_TEXT

The description for the forum.

$forum_grouping_id

\?AUTO_LINK

What forum grouping the forum will be filed with (null: this is the root forum).

$access_mapping

\?array

Permission map (null: do it the standard way, outside of this function). This parameter is for import/compatibility only and works upon an emulation of 'access levels' (ala Composr 2.5/2.6), and it is recommended to use the normal crud_module functionality for permissions setting.

$parent_forum

\?AUTO_LINK

The ID of the parent forum (null: this is the root forum).

$position

integer

The position of this forum relative to other forums viewable on the same screen (if parent forum hasn't specified automatic ordering).

$post_count_increment

\BINARY

Whether post counts will be incremented if members post in the forum.

$order_sub_alpha

\BINARY

Whether the ordering of subforums is done automatically, alphabetically).

$intro_question

\LONG_TEXT

The question that is shown for newbies to the forum (blank: none).

$intro_answer

\SHORT_TEXT

The answer to the question (blank: no specific answer.. if there's a 'question', it just requires a click-through).

$redirection

\SHORT_TEXT

Either blank for no redirection, the ID of another forum we are mirroring, or a URL to redirect to.

$order

\ID_TEXT

The order the topics are shown in, by default.

$is_threaded

\BINARY

Whether the forum is threaded.

Returns

\AUTO_LINKThe ID of the newly created forum.

Add a forum grouping.

cns_make_forum_grouping(\SHORT_TEXT $title, \SHORT_TEXT $description, \BINARY $expanded_by_default = 1) : \AUTO_LINK
package core_cns

Parameters

$title

\SHORT_TEXT

The title of the forum grouping.

$description

\SHORT_TEXT

The description of the forum grouping.

$expanded_by_default

\BINARY

Whether the forum grouping will be shown expanded by default (as opposed to contracted, where contained forums will not be shown until expansion).

Returns

\AUTO_LINKThe ID of the forum grouping just added.

Add a usergroup.

cns_make_group(\SHORT_TEXT $name, \BINARY $is_default = 0, \BINARY $is_super_admin = 0, \BINARY $is_super_moderator = 0, \SHORT_TEXT $title = '', \URLPATH $rank_image = '', \?GROUP $promotion_target = null, \?integer $promotion_threshold = null, \?MEMBER $group_leader = null, \?integer $flood_control_submit_secs = null, \?integer $flood_control_access_secs = null, \?integer $max_daily_upload_mb = null, \?integer $max_attachments_per_post = null, \?integer $max_avatar_width = null, \?integer $max_avatar_height = null, \?integer $max_post_length_comcode = null, \?integer $max_sig_length_comcode = null, \?integer $gift_points_base = null, \?integer $gift_points_per_day = null, \BINARY $enquire_on_new_ips = 0, \BINARY $is_presented_at_install = 0, \BINARY $hidden = 0, \?integer $order = null, \BINARY $rank_image_pri_only = 1, \BINARY $open_membership = 0, \BINARY $is_private_club = 0, boolean $uniqify = false, boolean $comes_with_permissions = true) : \AUTO_LINK
package core_cns

Parameters

$name

\SHORT_TEXT

The name of the usergroup.

$is_default

\BINARY

Whether members are automatically put into the when they join.

$is_super_admin

\BINARY

Whether members of this usergroup are all super administrators.

$is_super_moderator

\BINARY

Whether members of this usergroup are all super moderators.

$title

\SHORT_TEXT

The title for primary members of this usergroup that don't have their own title.

$rank_image

\URLPATH

The rank image for this.

$promotion_target

\?GROUP

The that members of this usergroup get promoted to at point threshold (null: no promotion prospects).

$promotion_threshold

\?integer

The point threshold for promotion (null: no promotion prospects).

$group_leader

\?MEMBER

The leader of this usergroup (null: none).

$flood_control_submit_secs

\?integer

The number of seconds that members of this usergroup must endure between submits (group 'best of' applies). 0 means N/A. (null: average for existing usergroups)

$flood_control_access_secs

\?integer

The number of seconds that members of this usergroup must endure between accesses (group 'best of' applies). 0 means N/A. (null: average for existing usergroups)

$max_daily_upload_mb

\?integer

The number of megabytes that members of this usergroup may attach per day (group 'best of' applies). (null: average for existing usergroups)

$max_attachments_per_post

\?integer

The number of attachments that members of this usergroup may attach to something (group 'best of' applies). (null: average for existing usergroups)

$max_avatar_width

\?integer

The maximum avatar width that members of this usergroup may have (group 'best of' applies). (null: average for existing usergroups)

$max_avatar_height

\?integer

The maximum avatar height that members of this usergroup may have (group 'best of' applies). (null: average for existing usergroups)

$max_post_length_comcode

\?integer

The maximum post length that members of this usergroup may make (group 'best of' applies). (null: average for existing usergroups)

$max_sig_length_comcode

\?integer

The maximum signature length that members of this usergroup may make (group 'best of' applies). (null: average for existing usergroups)

$gift_points_base

\?integer

The number of gift points that members of this usergroup start with (group 'best of' applies). (null: average for existing usergroups)

$gift_points_per_day

\?integer

The number of gift points that members of this usergroup get per day (group 'best of' applies). (null: average for existing usergroups)

$enquire_on_new_ips

\BINARY

Whether e-mail confirmation is needed for new IP addresses seen for any member of this usergroup (group 'best of' applies).

$is_presented_at_install

\BINARY

Whether the usergroup is presented for joining at joining (implies anyone may be in the, but only choosable at joining)

$hidden

\BINARY

Whether the name and membership of the is hidden

$order

\?integer

The display order this will be given, relative to other usergroups. Lower numbered usergroups display before higher numbered usergroups (null: next).

$rank_image_pri_only

\BINARY

Whether the rank image will not be shown for secondary membership

$open_membership

\BINARY

Whether members may join this usergroup without requiring any special permission

$is_private_club

\BINARY

Whether this usergroup is a private club. Private clubs may be managed in the CMS zone, and do not have any special permissions - except over their own associated forum.

$uniqify

boolean

Whether to force the title as unique, if there's a conflict

$comes_with_permissions

boolean

Whether permissions should be auto-copied

Returns

\AUTO_LINKThe ID of the new.

Add a member.

cns_make_member(\SHORT_TEXT $username, \SHORT_TEXT $password, \SHORT_TEXT $email_address, \?array $secondary_groups, \?integer $dob_day, \?integer $dob_month, \?integer $dob_year, array $custom_fields, \?ID_TEXT $timezone = null, \?GROUP $primary_group = null, \BINARY $validated = 1, \?TIME $join_time = null, \?TIME $last_visit_time = null, \ID_TEXT $theme = '', \?URLPATH $avatar_url = null, \LONG_TEXT $signature = '', \BINARY $is_perm_banned = 0, \?BINARY $preview_posts = null, \BINARY $reveal_age = 0, \SHORT_TEXT $title = '', \URLPATH $photo_url = '', \URLPATH $photo_thumb_url = '', \BINARY $views_signatures = 1, \?BINARY $auto_monitor_contrib_content = null, \?LANGUAGE_NAME $language = null, \BINARY $allow_emails = 1, \BINARY $allow_emails_from_staff = 1, \?IP $ip_address = null, \SHORT_TEXT $validated_email_confirm_code = '', boolean $check_correctness = true, \?ID_TEXT $password_compatibility_scheme = null, \SHORT_TEXT $salt = '', \?TIME $last_submit_time = null, \?AUTO_LINK $id = null, \BINARY $highlighted_name = 0, \SHORT_TEXT $pt_allow = '*', \LONG_TEXT $pt_rules_text = '', \?TIME $on_probation_until = null) : \AUTO_LINK
package core_cns

Parameters

$username

\SHORT_TEXT

The username.

$password

\SHORT_TEXT

The password.

$email_address

\SHORT_TEXT

The e-mail address.

$secondary_groups

\?array

A list of secondary usergroups (null: default/current usergroups).

$dob_day

\?integer

Day of date of birth (null: unknown).

$dob_month

\?integer

Month of date of birth (null: unknown).

$dob_year

\?integer

Year of date of birth (null: unknown).

$custom_fields

array

A map of custom field values (fieldID=>value).

$timezone

\?ID_TEXT

The member timezone (null: auto-detect).

$primary_group

\?GROUP

The member's primary (null: default).

$validated

\BINARY

Whether the profile has been validated.

$join_time

\?TIME

When the member joined (null: now).

$last_visit_time

\?TIME

When the member last visited (null: now).

$theme

\ID_TEXT

The member's default theme.

$avatar_url

\?URLPATH

The URL to the member's avatar (blank: none) (null: choose one automatically).

$signature

\LONG_TEXT

The member's signature (blank: none).

$is_perm_banned

\BINARY

Whether the member is permanently banned.

$preview_posts

\?BINARY

Whether posts are previewed before they are made (null: calculate automatically).

$reveal_age

\BINARY

Whether the member's age may be shown.

$title

\SHORT_TEXT

The member's title (blank: get from primary).

$photo_url

\URLPATH

The URL to the member's photo (blank: none).

$photo_thumb_url

\URLPATH

The URL to the member's photo thumbnail (blank: none).

$views_signatures

\BINARY

Whether the member sees signatures in posts.

$auto_monitor_contrib_content

\?BINARY

Whether the member automatically is enabled for notifications for content they contribute to (null: get default from config).

$language

\?LANGUAGE_NAME

The member's language (null: auto detect).

$allow_emails

\BINARY

Whether the member allows e-mails via the site.

$allow_emails_from_staff

\BINARY

Whether the member allows e-mails from staff via the site.

$ip_address

\?IP

The member's IP address (null: IP address of current user).

$validated_email_confirm_code

\SHORT_TEXT

The code required before the account becomes active (blank: already entered).

$check_correctness

boolean

Whether to check details for correctness.

$password_compatibility_scheme

\?ID_TEXT

The compatibility scheme that the password operates in (blank: none) (null: none [meaning normal Composr salted style] or plain, depending on whether passwords are encrypted).

$salt

\SHORT_TEXT

The password salt (blank: password compatibility scheme does not use a salt / auto-generate).

$last_submit_time

\?TIME

The time the member last made a submission (null: set to now).

$id

\?AUTO_LINK

Force an ID (null: don't force an ID)

$highlighted_name

\BINARY

Whether the member username will be highlighted.

$pt_allow

\SHORT_TEXT

Usergroups that may PT the member.

$pt_rules_text

\LONG_TEXT

Rules that other members must agree to before they may start a PT with the member.

$on_probation_until

\?TIME

When the member is on probation until (null: not on probation)

Returns

\AUTO_LINKThe ID of the new member.

Add a multi moderation to the system.

cns_make_multi_moderation(\SHORT_TEXT $name, \LONG_TEXT $post_text, \?AUTO_LINK $move_to, \?BINARY $pin_state, \?BINARY $sink_state, \?BINARY $open_state, \SHORT_TEXT $forum_multi_code = '*', \SHORT_TEXT $title_suffix = '') : \AUTO_LINK
package core_cns

Parameters

$name

\SHORT_TEXT

The name of the multi moderation.

$post_text

\LONG_TEXT

The post text to add when applying (blank: don't add a post).

$move_to

\?AUTO_LINK

The forum to move the topic when applying (null: do not move).

$pin_state

\?BINARY

The pin state after applying (null: unchanged).

$sink_state

\?BINARY

The sink state after applying (null: unchanged).

$open_state

\?BINARY

The open state after applying (null: unchanged).

$forum_multi_code

\SHORT_TEXT

The forum multi code for where this multi moderation may be applied.

$title_suffix

\SHORT_TEXT

The title suffix.

Returns

\AUTO_LINKThe ID of the multi moderation just added.

Add a forum poll.

cns_make_poll(\AUTO_LINK $topic_id, \SHORT_TEXT $question, \BINARY $is_private, \BINARY $is_open, integer $minimum_selections, integer $maximum_selections, \BINARY $requires_reply, array $answers, boolean $check_permissions = true) : \AUTO_LINK
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic to add the poll to.

$question

\SHORT_TEXT

The question.

$is_private

\BINARY

Whether the result tallies are kept private until the poll is made non-private.

$is_open

\BINARY

Whether the poll is open for voting.

$minimum_selections

integer

The minimum number of selections that may be made.

$maximum_selections

integer

The maximum number of selections that may be made.

$requires_reply

\BINARY

Whether members must have a post in the topic before they made vote.

$answers

array

A list of pairs of the potential voteable answers and the number of votes.

$check_permissions

boolean

Whether to check there are permissions to make the poll.

Returns

\AUTO_LINKThe ID of the newly created forum poll.

Add a post.

cns_make_post(\AUTO_LINK $topic_id, \SHORT_TEXT $title, \LONG_TEXT $post, \BINARY $skip_sig = 0, \?boolean $is_starter = false, \?BINARY $validated = null, \BINARY $is_emphasised = 0, \?string $poster_name_if_guest = null, \?IP $ip_address = null, \?TIME $time = null, \?MEMBER $poster = null, \?MEMBER $intended_solely_for = null, \?TIME $last_edit_time = null, \?MEMBER $last_edit_by = null, boolean $check_permissions = true, boolean $update_caching = true, \?AUTO_LINK $forum_id = null, boolean $support_attachments = true, \?string $topic_title = '', \BINARY $sunk = 0, \?AUTO_LINK $id = null, boolean $anonymous = false, boolean $skip_post_checks = false, \?boolean $is_pt = false, boolean $insert_comcode_as_admin = false, \?AUTO_LINK $parent_id = null, boolean $send_notification = true) : \AUTO_LINK
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic to add the post to.

$title

\SHORT_TEXT

The title of the post (may be blank).

$post

\LONG_TEXT

The post.

$skip_sig

\BINARY

Whether to skip showing the posters signature in the post.

$is_starter

\?boolean

Whether the post is the first in the topic (null: work it out).

$validated

\?BINARY

Whether the post is validated (null: unknown, find whether it needs to be marked unvalidated initially).

$is_emphasised

\BINARY

Whether the post is marked emphasised.

$poster_name_if_guest

\?string

The name of the person making the post (null: username of current member).

$ip_address

\?IP

The IP address the post is to be made under (null: IP of current user).

$time

\?TIME

The time of the post (null: now).

$poster

\?MEMBER

The poster (null: current member).

$intended_solely_for

\?MEMBER

The member that this post is intended solely for (null: public).

$last_edit_time

\?TIME

The last edit time of the post (null: never edited).

$last_edit_by

\?MEMBER

The member that was last to edit the post (null: never edited).

$check_permissions

boolean

Whether to check permissions for whether the post may be made as it is given.

$update_caching

boolean

Whether to update the caches after making the post.

$forum_id

\?AUTO_LINK

The forum the post will be in (null: find out from the DB).

$support_attachments

boolean

Whether to allow attachments in this post.

$topic_title

\?string

The title of the topic (null: find from the DB).

$sunk

\BINARY

Whether the topic is a sunk topic.

$id

\?AUTO_LINK

Force an ID (null: don't force an ID)

$anonymous

boolean

Whether to make the post anonymous

$skip_post_checks

boolean

Whether to skip post checks

$is_pt

\?boolean

Whether this is for a new Private Topic (null: work it out)

$insert_comcode_as_admin

boolean

Whether to explicitly insert the Comcode with admin privileges

$parent_id

\?AUTO_LINK

Parent post ID (null: none-threaded/root-of-thread)

$send_notification

boolean

Whether to send out notifications

Returns

\AUTO_LINKThe ID of the new post.

Make a post template.

cns_make_post_template(\SHORT_TEXT $title, \LONG_TEXT $text, \SHORT_TEXT $forum_multi_code, \BINARY $use_default_forums) : \AUTO_LINK
package core_cns

Parameters

$title

\SHORT_TEXT

The title for the template.

$text

\LONG_TEXT

The text of the template.

$forum_multi_code

\SHORT_TEXT

The multi code specifying which forums this is applicable in.

$use_default_forums

\BINARY

Whether to use this as the default post in applicable forum.

Returns

\AUTO_LINKThe added ID

Add a topic.

cns_make_topic(\?AUTO_LINK $forum_id, \SHORT_TEXT $description = '', \SHORT_TEXT $emoticon = '', \?BINARY $validated = null, \BINARY $open = 1, \BINARY $pinned = 0, \BINARY $sunk = 0, \BINARY $cascading = 0, \?MEMBER $pt_from = null, \?MEMBER $pt_to = null, boolean $check_perms = true, integer $num_views = 0, \?AUTO_LINK $id = null, \SHORT_TEXT $description_link = '') : \AUTO_LINK

This does not create the first post, you need to do an cns_make_post call for that. Conversr allows topics with zero posts.

package core_cns

Parameters

$forum_id

\?AUTO_LINK

The ID of the forum the topic will be in (null: Private Topic).

$description

\SHORT_TEXT

Description of the topic.

$emoticon

\SHORT_TEXT

The theme image code of the emoticon for the topic.

$validated

\?BINARY

Whether the topic is validated (null: detect whether it should be).

$open

\BINARY

Whether the topic is open.

$pinned

\BINARY

Whether the topic is pinned.

$sunk

\BINARY

Whether the topic is sunk.

$cascading

\BINARY

Whether the topic is cascading.

$pt_from

\?MEMBER

If it is a Private Topic, who is it 'from' (null: not a Private Topic).

$pt_to

\?MEMBER

If it is a Private Topic, who is it 'to' (null: not a Private Topic).

$check_perms

boolean

Whether to check the poster has permissions for the given topic settings.

$num_views

integer

The number of times the topic has been viewed.

$id

\?AUTO_LINK

Force an ID (null: don't force an ID)

$description_link

\SHORT_TEXT

Link related to the topic (e.g. link to view a ticket).

Returns

\AUTO_LINKThe ID of the newly created topic.

Add a formal warning.

cns_make_warning(\MEMBER $member_id, \LONG_TEXT $explanation, \?MEMBER $by = null, \?TIME $time = null, \BINARY $is_warning = 1, \?AUTO_LINK $silence_from_topic = null, \?AUTO_LINK $silence_from_forum = null, integer $probation = 0, \IP $banned_ip = '', integer $charged_points = 0, \BINARY $banned_member = 0, \?GROUP $changed_usergroup_from = null) : \AUTO_LINK
package core_cns

Parameters

$member_id

\MEMBER

The member being warned.

$explanation

\LONG_TEXT

An explanation for why the member is being warned.

$by

\?MEMBER

The member doing the warning (null: current member).

$time

\?TIME

The time of the warning (null: now).

$is_warning

\BINARY

Whether this counts as a warning

$silence_from_topic

\?AUTO_LINK

The topic being silenced from (null: none)

$silence_from_forum

\?AUTO_LINK

The forum being silenced from (null: none)

$probation

integer

Number of extra days for probation

$banned_ip

\IP

The IP address being banned (blank: none)

$charged_points

integer

The points being charged

$banned_member

\BINARY

Whether the member is being banned

$changed_usergroup_from

\?GROUP

The usergroup being changed from (null: no change)

Returns

\AUTO_LINKThe ID of the newly created warning.

Make a Welcome E-mail.

cns_make_welcome_email(\SHORT_TEXT $name, \SHORT_TEXT $subject, \LONG_TEXT $text, integer $send_time, \?AUTO_LINK $newsletter = null, \?AUTO_LINK $usergroup = null, \ID_TEXT $usergroup_type = '') : \AUTO_LINK
package core_cns
set primary secondary ""

Parameters

$name

\SHORT_TEXT

A name for the Welcome E-mail

$subject

\SHORT_TEXT

The subject of the Welcome E-mail

$text

\LONG_TEXT

The message body of the Welcome E-mail

$send_time

integer

The number of hours before sending the e-mail

$newsletter

\?AUTO_LINK

What newsletter to send out to instead of members (null: none)

$usergroup

\?AUTO_LINK

The usergroup to tie to (null: none)

$usergroup_type

\ID_TEXT

How to send regarding usergroups (blank: indiscriminately)

Returns

\AUTO_LINKThe ID

Find whether a member may attach a poll to a detailed topic.

cns_may_attach_poll(\AUTO_LINK $topic_id, \?MEMBER $topic_owner = null, \?boolean $has_poll_already = null, \?MEMBER $forum_id = null, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$topic_id

\AUTO_LINK

The topic.

$topic_owner

\?MEMBER

The topic owner (null: ask the DB for it).

$has_poll_already

\?boolean

Whether the topic already has a poll (null: ask the DB for it).

$forum_id

\?MEMBER

The forum the topic is in (null: ask the DB for it).

$member_id

\?MEMBER

The member we are checking for (null: current member).

Returns

booleanThe answer.

Find whether a certain member may control a certain usergroup.

cns_may_control_group(\GROUP $group_id, \MEMBER $member_id) : boolean
package core_cns

Parameters

$group_id

\GROUP

The usergroup.

$member_id

\MEMBER

The member.

Returns

booleanThe answer.

Find whether a member can delete a poll owned by a certain member in a certain forum.

cns_may_delete_poll_by(\AUTO_LINK $forum_id, \MEMBER $poll_owner, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum.

$poll_owner

\MEMBER

The poll owner.

$member_id

\?MEMBER

The member we are checking for (null: current member).

Returns

booleanThe answer.

Find whether a member may delete the detailed post.

cns_may_delete_post_by(\AUTO_LINK $post_id, \?TIME $post_time = null, \?MEMBER $resource_owner, \?AUTO_LINK $forum_id, \?MEMBER $member_id = null, \?boolean $topic_is_closed = null, \?string $reason = null) : boolean
package core_cns

Parameters

$post_id

\AUTO_LINK

The post ID.

$post_time

\?TIME

The time of the post (null: lookup).

$resource_owner

\?MEMBER

The owner of the post (null: lookup).

$forum_id

\?AUTO_LINK

The forum the post is in (null: is a Private Topic, unless $post_time is NULL in which case we look this up too).

$member_id

\?MEMBER

The member (null: current member).

$topic_is_closed

\?boolean

Whether the topic the post is in is closed (null: don't consider this, maybe we're not considering any one specific case, unless $post_time is NULL in which case we look this up to).

$reason

\?string

The reason for the topic being closed is put here (null: no interesting reason).

Returns

booleanThe answer.

Find whether a member may delete topics in a certain forum.

cns_may_delete_topics_by(\AUTO_LINK $forum_id, \MEMBER $member_id, \MEMBER $resource_owner) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum the topic would be in.

$member_id

\MEMBER

The member checking access for.

$resource_owner

\MEMBER

The member that owns this resource

Returns

booleanThe answer.

Find whether a member can alter a poll owned by a certain member in a certain forum.

cns_may_edit_poll_by(\AUTO_LINK $forum_id, \MEMBER $poll_owner, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum.

$poll_owner

\MEMBER

The poll owner.

$member_id

\?MEMBER

The member we are checking for (null: current member).

Returns

booleanThe answer.

Find whether a member may edit the detailed post.

cns_may_edit_post_by(\AUTO_LINK $post_id, \?TIME $post_time, \?MEMBER $resource_owner, \?AUTO_LINK $forum_id, \?MEMBER $member_id = null, \?boolean $topic_is_closed = null, \?string $reason = null) : boolean
package core_cns

Parameters

$post_id

\AUTO_LINK

The post ID.

$post_time

\?TIME

The time of the post (null: lookup).

$resource_owner

\?MEMBER

The owner of the post (null: lookup).

$forum_id

\?AUTO_LINK

The forum the post is in (null: is a Private Topic, unless $post_time is NULL in which case we look this up too).

$member_id

\?MEMBER

The member (null: current member).

$topic_is_closed

\?boolean

Whether the topic the post is in is closed (null: don't consider this, maybe we're not considering any one specific case, unless $post_time is NULL in which case we look this up to).

$reason

\?string

The reason for the topic being closed is put here (null: no interesting reason).

Returns

booleanThe answer.

Find whether a member may edit topics in a certain forum.

cns_may_edit_topics_by(\AUTO_LINK $forum_id, \MEMBER $member_id, \MEMBER $resource_owner) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum the topic would be in.

$member_id

\MEMBER

The member checking access for.

$resource_owner

\MEMBER

The member that owns this resource

Returns

booleanThe answer.

Find whether a member may make a Private Topic.

cns_may_make_private_topic(\?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanThe answer.

Find whether a member may moderate a certain forum.

cns_may_moderate_forum(\AUTO_LINK $forum_id, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum.

$member_id

\?MEMBER

The member ID (null: current member).

Returns

booleanThe answer.

Whether a certain member may perform multi moderations in a certain forum.

cns_may_perform_multi_moderation(\AUTO_LINK $forum_id, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum.

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanAnswer.

Find whether a member may post in a certain topic.

cns_may_post_in_topic(\AUTO_LINK $forum_id, \AUTO_LINK $topic_id, \?MEMBER $last_member_id = null, boolean $closed = false, \?MEMBER $member_id = null, boolean $will_be_private_post = false) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum ID of the forum the topic is in.

$topic_id

\AUTO_LINK

The topic ID is in.

$last_member_id

\?MEMBER

The last poster in the topic (null: do not check for double posting).

$closed

boolean

Whether this topic is closed.

$member_id

\?MEMBER

The member (null: current member).

$will_be_private_post

boolean

Whether this post will be private.

Returns

booleanThe answer.

Find whether a member may post a topic in a certain forum.

cns_may_post_topic(\AUTO_LINK $forum_id, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$forum_id

\AUTO_LINK

The forum the topic would be in.

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanThe answer.

Find whether a member may report a post.

cns_may_report_post(\?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanThe answer.

Whether a certain member may give formal warnings to other members.

cns_may_warn_members(\?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$member_id

\?MEMBER

The member (null: current member).

Returns

booleanAnswer.

Find if a certain member may be PTd be a certain member.

cns_may_whisper(\MEMBER $target, \?MEMBER $member_id = null) : boolean
package core_cns

Parameters

$target

\MEMBER

Member to be PT'd

$member_id

\?MEMBER

Member to PT. (null: current member)

Returns

booleanWhether the PT may be created

Mark a member as applying to be in a certain, and inform the leader.

cns_member_ask_join_group(\GROUP $group_id, \?MEMBER $member_id = null
package core_cns

Parameters

$group_id

\GROUP

The usergroup to apply to.

$member_id

\?MEMBER

The member applying (null: current member).

Edit a member's avatar, and check validity.

cns_member_choose_avatar(\URLPATH $avatar_url, \?MEMBER $member_id = null
package core_cns

Parameters

$avatar_url

\URLPATH

The new avatar URL.

$member_id

\?MEMBER

The member (null: the current member).

Edit a member's photo, and check validity.

cns_member_choose_photo(\ID_TEXT $param_name, \ID_TEXT $upload_name, \?MEMBER $member_id = null
package core_cns

Parameters

$param_name

\ID_TEXT

The identifier for the name of the posted URL field.

$upload_name

\ID_TEXT

The identifier for the name of the posted upload.

$member_id

\?MEMBER

The member (null: the current member).

Edit a member's photo.

cns_member_choose_photo_concrete(\URLPATH $url, \URLPATH $thumb_url, \?MEMBER $member_id = null
package core_cns

Parameters

$url

\URLPATH

URL to photo.

$thumb_url

\URLPATH

URL to thumbnail photo.

$member_id

\?MEMBER

The member (null: the current member).

Edit a member's signature, and check validity.

cns_member_choose_signature(\LONG_TEXT $new_signature, \?MEMBER $member_id = null
package core_cns

Parameters

$new_signature

\LONG_TEXT

The new signature.

$member_id

\?MEMBER

The member (null: the current member).

Edit a member's personal title, and check validity.

cns_member_choose_title(\SHORT_TEXT $new_title, \?MEMBER $member_id = null
package core_cns

Parameters

$new_title

\SHORT_TEXT

The new title.

$member_id

\?MEMBER

The member (null: the current member).

Finishing off of a member profile (such as for LDAP or httpauth, where a partial profile is automatically made, but needs completion).

cns_member_external_linker(\SHORT_TEXT $username, \SHORT_TEXT $password, \ID_TEXT $type, boolean $email_check = true, string $email_address = '', \?integer $dob_day = null, \?integer $dob_month = null, \?integer $dob_year = null, \?ID_TEXT $timezone = null, \?ID_TEXT $language = null, \?URLPATH $avatar_url = null, \URLPATH $photo_url = '', \URLPATH $photo_thumb_url = '') : \MEMBER
package core_cns

Parameters

$username

\SHORT_TEXT

The username for the member profile.

$password

\SHORT_TEXT

The password for the member profile.

$type

\ID_TEXT

The type of member profile we are finishing off.

$email_check

boolean

Whether to check for duplicated email addresses.

$email_address

string

Auto-detected e-mail address (blank: none)

$dob_day

\?integer

Auto-detected DOB day (null: unknown)

$dob_month

\?integer

Auto-detected DOB month (null: unknown)

$dob_year

\?integer

Auto-detected DOB year (null: unknown)

$timezone

\?ID_TEXT

Auto-detected Timezone (null: unknown)

$language

\?ID_TEXT

Auto-detected Language (null: unknown)

$avatar_url

\?URLPATH

The URL to the member's avatar (blank: none) (null: choose one automatically).

$photo_url

\URLPATH

The URL to the member's photo (blank: none).

$photo_thumb_url

\URLPATH

The URL to the member's photo thumbnail (blank: none).

Returns

\MEMBERThe member ID for the finished off profile.

Get a form for finishing off a member profile (such as for LDAP or httpauth, where a partial profile is automatically made, but needs completion).

cns_member_external_linker_ask(\SHORT_TEXT $username, \ID_TEXT $type, string $email_address = '', \?integer $dob_day = null, \?integer $dob_month = null, \?integer $dob_year = null, \?ID_TEXT $timezone = null, \?ID_TEXT $language = null) : \Tempcode
package core_cns

Parameters

$username

\SHORT_TEXT

The username for the member profile.

$type

\ID_TEXT

The type of member profile we are finishing off.

$email_address

string

Auto-detected e-mail address (blank: none)

$dob_day

\?integer

Auto-detected DOB day (null: unknown)

$dob_month

\?integer

Auto-detected DOB month (null: unknown)

$dob_year

\?integer

Auto-detected DOB year (null: unknown)

$timezone

\?ID_TEXT

Auto-detected Timezone (null: unknown)

$language

\?ID_TEXT

Auto-detected Language (null: unknown)

Returns

\TempcodeThe form.

Check to see if a member deserves promotion, and handle it.

cns_member_handle_promotion(\?MEMBER $member_id = null
package core_cns

Parameters

$member_id

\?MEMBER

The member (null: current member).

Remove a member from a certain usergroup.

cns_member_leave_group(\GROUP $group_id, \?MEMBER $member_id = null
package core_cns

Parameters

$group_id

\GROUP

The usergroup to remove from.

$member_id

\?MEMBER

The member leaving (null: current member).

Set whether a member that has applied to be in a, may be in it, and inform them of the decision.

cns_member_validate_into_group(\GROUP $group_id, \MEMBER $prospective_member_id, boolean $decline = false, string $reason = ''
package core_cns

Parameters

$group_id

\GROUP

The usergroup.

$prospective_member_id

\MEMBER

The prospective member.

$decline

boolean

Whether the member is being declined membership.

$reason

string

The reason given for declining.

Log a moderation action.

cns_mod_log_it(\ID_TEXT $the_type, \SHORT_TEXT $param_a = '', \SHORT_TEXT $param_b = '', \LONG_TEXT $reason = '', \?MEMBER $by = null, \?TIME $date_and_time = null
package core_cns

Parameters

$the_type

\ID_TEXT

The type of moderation.

$param_a

\SHORT_TEXT

First detailing parameter.

$param_b

\SHORT_TEXT

Second detailing parameter.

$reason

\LONG_TEXT

The reason for the moderation (may be blank).

$by

\?MEMBER

The member performing the moderation (null: current member).

$date_and_time

\?TIME

The time of the moderation (null: just now).

Move posts from one topic to another.

cns_move_posts(\AUTO_LINK $from_topic_id, \?AUTO_LINK $to_topic_id, array $posts, \LONG_TEXT $reason, \?AUTO_LINK $to_forum_id = null, boolean $delete_if_empty = false, \?SHORT_TEXT $title = null) : boolean
package core_cns

Parameters

$from_topic_id

\AUTO_LINK

The ID of the source topic.

$to_topic_id

\?AUTO_LINK

The ID of the destination topic (null: move to new topic in $forum_id).

$posts

array

A list of post IDs to move.

$reason

\LONG_TEXT

The reason for this action.

$to_forum_id

\?AUTO_LINK

The forum the destination topic is in (null: find from DB).

$delete_if_empty

boolean

Whether to delete the topic if all posts in it have been moved.

$title

\?SHORT_TEXT

The title for the new topic (null: work out / irrelevant).

Returns

booleanWhether the topic was deleted.

Move some topics.

cns_move_topics(\AUTO_LINK $from, \AUTO_LINK $to, \?array $topics = null, boolean $check_perms = true
package core_cns

Parameters

$from

\AUTO_LINK

The forum the topics are currently in.

$to

\AUTO_LINK

The forum the topics are being moved to.

$topics

\?array

A list of the topic IDs to move (null: move all topics from source forum).

$check_perms

boolean

Whether to check permissions.

Organise a list of forum rows into a tree structure.

cns_organise_into_tree(array $all_forums, \AUTO_LINK $forum_id) : array
package core_cns

Parameters

$all_forums

array

The list of all forum rows (be aware that this will get modified for performance reasons).

$forum_id

\AUTO_LINK

The forum row that we are taking as the root of our current recursion.

Returns

arrayThe child list of $forum_id.

Perform a multi moderation.

cns_perform_multi_moderation(\AUTO_LINK $id, \AUTO_LINK $topic_id, \LONG_TEXT $reason, \LONG_TEXT $post_text = '', \BINARY $is_emphasised = 1, \BINARY $skip_sig = 0
package core_cns

Parameters

$id

\AUTO_LINK

The ID of the multi moderation we are performing.

$topic_id

\AUTO_LINK

The ID of the topic we are performing the multi moderation on.

$reason

\LONG_TEXT

The reason for performing the multi moderation (may be blank).

$post_text

\LONG_TEXT

The post text for a post to be added to the topic (blank: do not add a post).

$is_emphasised

\BINARY

Whether the post is marked emphasised.

$skip_sig

\BINARY

Whether to skip showing the posters signature in the post.

Mark all recent topics in a certain forum as read for the current member.

cns_ping_forum_read_all(\AUTO_LINK $forum_id) 
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum.

Mark all recent topics in a certain forum as unread for the current member.

cns_ping_forum_unread_all(\AUTO_LINK $forum_id) 
package core_cns

Parameters

$forum_id

\AUTO_LINK

The ID of the forum.

Mark a topic as read by the current member.

cns_ping_topic_read(\AUTO_LINK $topic_id, \?MEMBER $member_id = null
package core_cns

Parameters

$topic_id

\AUTO_LINK

The ID of the topic to mark as read.

$member_id

\?MEMBER

The member to do this for (null: current member).

Find a map of results relating to a certain poll.

cns_poll_get_results(\AUTO_LINK $poll_id, boolean $request_results = true) : array
package core_cns

Parameters

$poll_id

\AUTO_LINK

The poll.

$request_results

boolean

Whether we must record that the current member is requesting the results, blocking future voting for them.

Returns

arrayThe map of results.

Read in the custom profile field POST data.

cns_read_in_custom_fields(array $custom_fields, \?MEMBER $member_id = null) : array
package core_cns

Parameters

$custom_fields

array

The CPF field rows that we'll be reading in the member's values for.

$member_id

\?MEMBER

Member involved (null: new member)

Returns

arrayThe CPF data.

Get details on a member profile.

cns_read_in_member_profile(\MEMBER $member_id, boolean $lite = true) : array
package core_cns

Parameters

$member_id

\MEMBER

The member to get details of.

$lite

boolean

Whether to get a 'lite' version (contains less detail, therefore less costly).

Returns

arrayA map of details.

Send out a notification, as a topic just got a new post.

cns_send_topic_notification(\URLPATH $url, \AUTO_LINK $topic_id, \?AUTO_LINK $forum_id, \MEMBER $sender_member_id, boolean $is_starter, \LONG_TEXT $post, \SHORT_TEXT $topic_title, \?MEMBER $_limit_to = null, boolean $is_pt = false, \?ID_TEXT $no_notify_for__notification_code = null, \?SHORT_TEXT $no_notify_for__code_category = null
package core_cns

Parameters

$url

\URLPATH

The URL to view the new post.

$topic_id

\AUTO_LINK

The ID of the topic that got posted in.

$forum_id

\?AUTO_LINK

The forum that the topic is in (null: find out from the DB).

$sender_member_id

\MEMBER

The member that made the post triggering this tracking notification.

$is_starter

boolean

Whether the post started a new topic.

$post

\LONG_TEXT

The post, in Comcode format.

$topic_title

\SHORT_TEXT

The topic title (blank: look it up from the $topic_id). If non-blank we must use it as it is implying the database might not have the correct value yet.

$_limit_to

\?MEMBER

Only send the notification to this member (null: no such limit).

$is_pt

boolean

Whether this is for a Private Topic.

$no_notify_for__notification_code

\?ID_TEXT

DO NOT send notifications to: The notification code (null: no restriction)

$no_notify_for__code_category

\?SHORT_TEXT

DO NOT send notifications to: The category within the notification code (null: none / no restriction)

Set the forum context.

cns_set_context_forum(\AUTO_LINK $forum_id) 
package core_cns

Parameters

$forum_id

\AUTO_LINK

Forum ID.

Set a custom profile field for a member.

cns_set_custom_field(\MEMBER $member_id, \AUTO_LINK $field, mixed $value, \?ID_TEXT $type = null, boolean $defer = false) : \?array
package core_cns

Parameters

$member_id

\MEMBER

The member.

$field

\AUTO_LINK

The field being set.

$value

mixed

The value of the field. For a trans-type field, this can be either a lang-ID to be copied (from forum DB), or an actual string.

$type

\?ID_TEXT

The field type (null: look it up).

$defer

boolean

Whether to defer the change, by returning a result change rather than doing it right away.

Returns

\?arrayMapping change (null: none / can't defer).

Unban a member.

cns_unban_member(\AUTO_LINK $member_id) 
package core_cns

Parameters

$member_id

\AUTO_LINK

The ID of the member.

Validate a post.

cns_validate_post(\AUTO_LINK $post_id, \?AUTO_LINK $topic_id = null, \?AUTO_LINK $forum_id = null, \?MEMBER $poster = null, \?LONG_TEXT $post = null) : \AUTO_LINK
package core_cns

Parameters

$post_id

\AUTO_LINK

The ID of the post.

$topic_id

\?AUTO_LINK

The ID of the topic that contains the post (null: find out from the DB).

$forum_id

\?AUTO_LINK

The forum that the topic containing the post is in (null: find out from the DB).

$poster

\?MEMBER

The member that made the post being validated (null: find out from the DB).

$post

\?LONG_TEXT

The post, in Comcode format (null: It'll have to be looked-up).

Returns

\AUTO_LINKThe ID of the topic (whilst this could be known without calling this function, as we've gone to effort and grabbed it from the DB, it might turn out useful for something).

Place a vote on a specified poll.

cns_vote_in_poll(\AUTO_LINK $poll_id, array $votes, \?MEMBER $member_id = null, \?array $topic_info = null
package core_cns

Parameters

$poll_id

\AUTO_LINK

The ID of the poll we're voting in.

$votes

array

A list of poll answers that are being voted for.

$member_id

\?MEMBER

The member that's voting (null: current member).

$topic_info

\?array

The row of the topic the poll is for (null: get it from the DB).

Generate a Tempcode tree based selection list for choosing a forum. Also capable of getting comma-separated ancester forum lists.

create_selection_list_forum_tree(\?MEMBER $member_id = null, \?AUTO_LINK $base_forum = null, \?array $selected_forum = null, boolean $use_compound_list = false, \?integer $levels = null, \?TIME $updated_since = null) : \Tempcode
package core_cns

Parameters

$member_id

\?MEMBER

The member that the view privileges are done for (null: current member).

$base_forum

\?AUTO_LINK

The forum we are starting from (null: capture the whole tree).

$selected_forum

\?array

The forum(s) to select by default (null: no preference). Only applies if !$topics_too. An array of AUTO_LINK's (for IDs) or strings (for names).

$use_compound_list

boolean

Whether to generate a compound list (a list of all the ancesters, for each point in the forum tree) as well as the tree.

$levels

\?integer

The number of recursive levels to search (null: all)

$updated_since

\?TIME

Time from which content must be updated (null: no limit).

Returns

\TempcodeForum selection list.

Get a list of timezones.

create_selection_list_timezone_list(\?string $timezone = null) : \Tempcode
package core_cns

Parameters

$timezone

\?string

Current timezone to select (null: server default)

Returns

\TempcodeList of timezones

Get the ID for a CPF if we only know the title. Warning: Only use this with custom code, never core code! It assumes a single language and that fields aren't renamed.

find_cpf_field_id(\SHORT_TEXT $title) : \?AUTO_LINK
package core_cns

Parameters

$title

\SHORT_TEXT

The title.

Returns

\?AUTO_LINKThe ID (null: could not find).

Get the ID for a usergroup if we only know the title. Warning: Only use this with custom code, never core code! It assumes a single language and that usergroups aren't renamed.

find_usergroup_id(\SHORT_TEXT $title) : \?AUTO_LINK
package core_cns

Parameters

$title

\SHORT_TEXT

The title.

Returns

\?AUTO_LINKThe ID (null: could not find).

Calculate Conversr notifications and render.

generate_notifications(\MEMBER $member_id) : array
package core_cns

Parameters

$member_id

\MEMBER

Member to look up for.

Returns

arrayA pair: Number of notifications, Rendered notifications.

Find how to store a field in the database.

get_cpf_storage_for(\ID_TEXT $type) : array
package core_cns

Parameters

$type

\ID_TEXT

The field type.

Returns

arrayA pair: the DB field type, whether to index.

Find the first default group.

get_first_default_group() : \GROUP
package core_cns

Returns

\GROUPThe first default group.

Get SQL clause to limit a query to accessible forums.

get_forum_access_sql(\ID_TEXT $field) : string
package core_cns

Parameters

$field

\ID_TEXT

Field name.

Returns

stringSQL clause.

Get a usergroup colour based on it's ID number.

get_group_colour(\GROUP $gid) : string
package core_cns

Parameters

$gid

\GROUP

ID number.

Returns

stringColour.

Get a member title.

get_member_title(\MEMBER $member_id) : string
package core_cns

Parameters

$member_id

\MEMBER

Member ID.

Returns

stringMember title.

If we are using human names for usernames, a conflict is likely. Store a suffixed variety. Maybe later Composr will strip these suffixes out in some contexts.

get_username_from_human_name(\SHORT_TEXT $username) : \SHORT_TEXT
package core_cns

Parameters

$username

\SHORT_TEXT

The desired human name for the member profile.

Returns

\SHORT_TEXTA unique username.

If necessary, send out a support ticket reply

handle_topic_ticket_reply(\AUTO_LINK $forum_id, \AUTO_LINK $topic_id, \SHORT_TEXT $topic_title, \LONG_TEXT $post) 
package core_cns

Parameters

$forum_id

\AUTO_LINK

Forum ID

$topic_id

\AUTO_LINK

Topic ID

$topic_title

\SHORT_TEXT

Topic title

$post

\LONG_TEXT

Post made

Utility function to import custom emoticons.

import_custom_emoticons(boolean $remove_old_core = false

Not used by default, but useful when coding projects to do hot-changes to a separate live site.

package core_cns

Parameters

$remove_old_core

boolean

Make some of the old core emoticons non-core (level 1).

Install/upgrade Conversr.

install_cns(\?float $upgrade_from = null
package core_cns

Parameters

$upgrade_from

\?float

The version to upgrade from (null: fresh install).

Find whether a member's field must be filled in.

member_field_is_required(\?MEMBER $member_id, string $field_class, \?string $current_value = null, \?MEMBER $editing_member = null) : boolean
package core_cns
set email_address dob required_cpfs

Parameters

$member_id

\?MEMBER

The member being edited (null: new member).

$field_class

string

Special code representing what kind of field it is.

$current_value

\?string

The value the field has now (null: lookup from member record; cannot do this for a CPF).

$editing_member

\?MEMBER

The member doing the adding/editing operation (null: current member).

Returns

booleanWhether the field must be filled in.

Get field mapping data for CSV import/export.

member_get_csv_headings() : array
package core_cns

Returns

arrayA map of heading information (human name to field name/encoding details)

Find if a member's account has expired, due to inactivity.

member_password_expired(\MEMBER $member_id) : boolean
package core_cns

Parameters

$member_id

\MEMBER

The member this is for

Returns

booleanWhether it is

Find if a member's password is too old.

member_password_too_old(\MEMBER $member_id) : boolean
package core_cns

Parameters

$member_id

\MEMBER

The member this is for

Returns

booleanWhether it is

Get a bit of SQL to make sure that a DB field is not like a spacer post in any of the languages.

not_like_spacer_posts(\ID_TEXT $field) : string
package core_cns

Parameters

$field

\ID_TEXT

The field name

Returns

stringThe SQL

Render a forum box.

render_forum_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, boolean $include_breadcrumbs = true, \?AUTO_LINK $root = null, \ID_TEXT $guid = '') : \Tempcode
package core_cns

Parameters

$row

array

Forum row

$zone

\ID_TEXT

Zone to link through to

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$include_breadcrumbs

boolean

Whether to include breadcrumbs (if there are any)

$root

\?AUTO_LINK

Virtual root to use (null: none)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe forum box

Render a usergroup box.

render_group_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, \ID_TEXT $guid = '') : \Tempcode
package core_cns

Parameters

$row

array

Usergroup row

$zone

\ID_TEXT

Zone to link through to

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe usergroup box

Get a member display box. Some terminology refers to a member here as a 'poster', as this function is used in forum topics also.

render_member_box(mixed $poster_details, boolean $preview = false, \?array $hooks = null, \?array $hook_objects = null, boolean $show_avatar = true, \?array $extra_fields = null, boolean $give_context = true, \ID_TEXT $guid = '') : \Tempcode
package core_cns

Parameters

$poster_details

mixed

Either a member ID or an array containing: ip_address, poster_num_warnings, poster, poster_posts, poster_points, poster_join_date_string, primary_group_name.

$preview

boolean

Whether only to show 'preview' details

$hooks

\?array

An array of hooks. (null: lookup)

$hook_objects

\?array

An array of hook objects that allow us to collect additional mouse-over member information. (null: lookup)

$show_avatar

boolean

Whether to show the avatar

$extra_fields

\?array

Map of extra fields to show (null: none)

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe member box

Show a post, isolated of the other posts in it's topic.

render_post_box(array $row, boolean $use_post_title = false, boolean $give_context = true, boolean $include_breadcrumbs = true, \?AUTO_LINK $root = null, \ID_TEXT $guid = '') : \Tempcode
package core_cns

Parameters

$row

array

The post row.

$use_post_title

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content). Also uses the post title, as opposed to the post's topic's title.

$give_context

boolean

Whether to embed a link to the topic.

$include_breadcrumbs

boolean

Whether to include breadcrumbs (if there are any)

$root

\?AUTO_LINK

Virtual root to use (null: none)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe isolated post.

Render a member profile.

render_profile_tabset(\Tempcode $title, \MEMBER $member_id_of, \?MEMBER $member_id_viewing = null, \?ID_TEXT $username = null) : \Tempcode
package core_cns

Parameters

$title

\Tempcode

Screen title

$member_id_of

\MEMBER

The ID of the member who is being viewed

$member_id_viewing

\?MEMBER

The ID of the member who is doing the viewing (null: current member)

$username

\?ID_TEXT

The username of the member who is being viewed (null: work out from member_id_of)

Returns

\TempcodeThe rendered profile

Render a topic box.

render_topic_box(array $row, \ID_TEXT $zone = '_SEARCH', boolean $give_context = true, boolean $include_breadcrumbs = true, \?AUTO_LINK $root = null, \ID_TEXT $guid = '') : \Tempcode
package core_cns

Parameters

$row

array

Topic row

$zone

\ID_TEXT

Zone to link through to

$give_context

boolean

Whether to include context (i.e. say WHAT this is, not just show the actual content)

$include_breadcrumbs

boolean

Whether to include breadcrumbs (if there are any)

$root

\?AUTO_LINK

Virtual root to use (null: none)

$guid

\ID_TEXT

Overridden GUID to send to templates (blank: none)

Returns

\TempcodeThe topic box

Pop-up some rules.

rules_script() 
package core_cns

Send a new-PT notification.

send_pt_notification(\AUTO_LINK $post_id, \SHORT_TEXT $subject, \AUTO_LINK $topic_id, \MEMBER $to_id, \?MEMBER $from_id = null, \?string $post_comcode = null, boolean $mark_unread = false
package core_cns

Parameters

$post_id

\AUTO_LINK

The ID of the post made

$subject

\SHORT_TEXT

PT title

$topic_id

\AUTO_LINK

ID of the topic

$to_id

\MEMBER

Member getting the PT

$from_id

\?MEMBER

Member posting the PT (null: current member)

$post_comcode

\?string

Post text (null: unknown, lookup from $post_id)

$mark_unread

boolean

Whether to also mark the topic as unread

Uninstall Conversr

uninstall_cns() 
package core_cns

Update caching against a member's username. This doesn't change the username in the actual member record -- it is assumed that this will be done elsewhere.

update_member_username_caching(\MEMBER $member_id, \ID_TEXT $username) 
package core_cns

Parameters

$member_id

\MEMBER

The member ID.

$username

\ID_TEXT

The new username that is being set for them.

Script for loading presets from saved warnings.

warnings_script() 
package core_cns