HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

ocPortal Developer's Guide: OCF forums

» Return to Contents



sources/ocf_forums.php

Global_functions_ocf_forums.php

Function summary

void init__ocf_forums ()
array ocf_organise_into_tree (array all_forums, AUTO_LINK forum_id)
mixed ocf_get_all_subordinate_forums (AUTO_LINK forum_id, ?string create_or_list, ?array tree, boolean ignore_permissions)
boolean ocf_may_moderate_forum (AUTO_LINK forum_id, ?MEMBER member_id)
string ocf_get_forum_parent_or_list (AUTO_LINK forum_id, ?AUTO_LINK parent_id)
tempcode ocf_forum_breadcrumbs (mixed end_point_forum, ?string this_name, ?AUTO_LINK parent_forum, boolean start)

void init__ocf_forums()

Standard code module initialisation function.

Parameters…

(No return value)


Return to the function index for this class Expand: View the source code to this function

array ocf_organise_into_tree(array all_forums, AUTO_LINK forum_id)

Organise a list of forum rows into a tree structure.

Parameters…

Name all_forums
Description The list of all forum rows (be aware that this will get modified for performance reasons).
Type array

Name forum_id
Description The forum row that we are taking as the root of our current recursion.
Type AUTO_LINK

Returns…

Description The child list of $forum_id.
Type array

Return to the function index for this class Expand: View the source code to this function

mixed ocf_get_all_subordinate_forums(AUTO_LINK forum_id, ?string create_or_list, ?array tree, boolean ignore_permissions)

Gets a list of subordinate forums of a certain forum.

Parameters…

Name forum_id
Description The ID of the forum we are finding subordinate forums of.
Type AUTO_LINK

Name create_or_list
Description The field name to use in the OR list (NULL: do not make an OR list, return an array).
Default value
Type ?string

Name tree
Description The forum tree structure (NULL: unknown, it will be found using ocf_organise_into_tree).
Default value
Type ?array

Name ignore_permissions
Description Whether to ignore permissions in this.
Default value boolean-false
Type boolean

Returns…

Description The list (is either a true list, or an OR list).
Type mixed

Return to the function index for this class Expand: View the source code to this function

boolean ocf_may_moderate_forum(AUTO_LINK forum_id, ?MEMBER member_id)

Find whether a member may moderate a certain forum.

Parameters…

Name forum_id
Description The ID of the forum.
Type AUTO_LINK

Name member_id
Description The member ID (NULL: current member).
Default value
Type ?MEMBER

Returns…

Description The answer.
Type boolean

Return to the function index for this class Expand: View the source code to this function

string ocf_get_forum_parent_or_list(AUTO_LINK forum_id, ?AUTO_LINK parent_id)

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

Parameters…

Name forum_id
Description The ID of the forum.
Type AUTO_LINK

Name parent_id
Description The ID of the parent forum (-1: get it from the DB) (NULL: there is no parent, as it is the root forum).
Default value -1
Type ?AUTO_LINK

Returns…

Description The OR list.
Type string

Return to the function index for this class Expand: View the source code to this function

tempcode ocf_forum_breadcrumbs(mixed end_point_forum, ?string this_name, ?AUTO_LINK parent_forum, boolean start)

Get a forum navigation tree (a horizontal thing that works backwards along the tree path ['bread crumb trail'], not a full tree).

Parameters…

Name end_point_forum
Description 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).
Type mixed

Name this_name
Description The name of the given forum (NULL: find it from the DB).
Default value
Type ?string

Name parent_forum
Description The parent forum of the given forum (NULL: find it from the DB).
Default value
Type ?AUTO_LINK

Name start
Description Whether this is being called as the recursion start of deriving the navigation tree (top level call).
Default value boolean-true
Type boolean

Returns…

Description The navigation tree.
Type tempcode

Return to the function index for this class Expand: View the source code to this function

sources/ocf_forums_action.php

Global_functions_ocf_forums_action.php

Function summary

AUTO_LINK ocf_make_category (SHORT_TEXT title, SHORT_TEXT description, BINARY expanded_by_default)
AUTO_LINK ocf_make_forum (SHORT_TEXT name, SHORT_TEXT description, ?AUTO_LINK category_id, ?array access_mapping, ?AUTO_LINK parent_forum, integer position, BINARY post_count_increment, BINARY order_sub_alpha, LONG_TEXT intro_question, SHORT_TEXT intro_answer, SHORT_TEXT redirection, ID_TEXT order, BINARY is_threaded)

AUTO_LINK ocf_make_category(SHORT_TEXT title, SHORT_TEXT description, BINARY expanded_by_default)

Add a forum category.

Parameters…

Name title
Description The title of the forum category.
Type SHORT_TEXT

Name description
Description The description of the forum category.
Type SHORT_TEXT

Name expanded_by_default
Description Whether the forum category will be shown expanded by default (as opposed to contracted, where contained forums will not be shown until expansion).
Default value 1
Type BINARY

Returns…

Description The ID of the forum category just added.
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function

AUTO_LINK ocf_make_forum(SHORT_TEXT name, SHORT_TEXT description, ?AUTO_LINK category_id, ?array access_mapping, ?AUTO_LINK parent_forum, integer position, BINARY post_count_increment, BINARY order_sub_alpha, LONG_TEXT intro_question, SHORT_TEXT intro_answer, SHORT_TEXT redirection, ID_TEXT order, BINARY is_threaded)

Make a forum.

Parameters…

Name name
Description The name of the forum.
Type SHORT_TEXT

Name description
Description The description for the forum.
Type SHORT_TEXT

Name category_id
Description What forum category the forum will be filed with (NULL: this is the root forum).
Type ?AUTO_LINK

Name access_mapping
Description 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 ocPortal 2.5/2.6), and it is recommended to use the normal aed_module functionality for permissions setting.
Type ?array

Name parent_forum
Description The ID of the parent forum (NULL: this is the root forum).
Type ?AUTO_LINK

Name position
Description The position of this forum relative to other forums viewable on the same screen (if parent forum hasn't specified automatic ordering).
Default value 1
Type integer

Name post_count_increment
Description Whether post counts will be incremented if members post in the forum.
Default value 1
Type BINARY

Name order_sub_alpha
Description Whether the ordering of subforums is done automatically, alphabetically).
Default value 0
Type BINARY

Name intro_question
Description The question that is shown for newbies to the forum (blank: none).
Default value
Type LONG_TEXT

Name intro_answer
Description The answer to the question (blank: no specific answer.. if there's a 'question', it just requires a click-through).
Default value
Type SHORT_TEXT

Name redirection
Description Either blank for no redirection, the ID of another forum we are mirroring, or a URL to redirect to.
Default value
Type SHORT_TEXT

Name order
Description The order the topics are shown in, by default.
Default value last_post
Type ID_TEXT

Name is_threaded
Description Whether the forum is threaded.
Default value 0
Type BINARY

Returns…

Description The ID of the newly created forum.
Type AUTO_LINK

Return to the function index for this class Expand: View the source code to this function