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

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


ocPortal Developer's Guide: OCF topics

» Return to Contents



sources/ocf_topics.php

Global_functions_ocf_topics.php

Function summary

string ocf_get_topic_where (AUTO_LINK topic_id)
boolean ocf_may_make_personal_topic (?MEMBER member_id)
boolean ocf_may_post_topic (AUTO_LINK forum_id, ?MEMBER member_id)
boolean ocf_may_report_post (?MEMBER member_id)
boolean ocf_has_replied_topic (AUTO_LINK topic_id, ?MEMBER member_id)
boolean ocf_may_edit_topics_by (AUTO_LINK forum_id, MEMBER member_id, MEMBER resource_owner)
boolean ocf_may_delete_topics_by (AUTO_LINK forum_id, MEMBER member_id, MEMBER resource_owner)
void ocf_ping_topic_read (AUTO_LINK topic_id, ?MEMBER member_id)
boolean ocf_has_read_topic (AUTO_LINK topic_id, ?TIME topic_last_time, ?MEMBER member_id, ?TIME member_last_time)
boolean ocf_has_special_pt_access (AUTO_LINK topic_id, ?MEMBER member_id)

string ocf_get_topic_where(AUTO_LINK topic_id)

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

Parameters…

Name topic_id
Description The ID of the topic we are getting details of.
Type AUTO_LINK

Returns…

Description The WHERE clause.
Type string

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

boolean ocf_may_make_personal_topic(?MEMBER member_id)

Find whether a member may make a Private Topic.

Parameters…

Name member_id
Description The member (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

boolean ocf_may_post_topic(AUTO_LINK forum_id, ?MEMBER member_id)

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

Parameters…

Name forum_id
Description The forum the topic would be in.
Type AUTO_LINK

Name member_id
Description The member (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

boolean ocf_may_report_post(?MEMBER member_id)

Find whether a member may report a post.

Parameters…

Name member_id
Description The member (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

boolean ocf_has_replied_topic(AUTO_LINK topic_id, ?MEMBER member_id)

Find whether a member has replied to a certain topic.

Parameters…

Name topic_id
Description The topic.
Type AUTO_LINK

Name member_id
Description The member (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

boolean ocf_may_edit_topics_by(AUTO_LINK forum_id, MEMBER member_id, MEMBER resource_owner)

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

Parameters…

Name forum_id
Description The forum the topic would be in.
Type AUTO_LINK

Name member_id
Description The member checking access for.
Type MEMBER

Name resource_owner
Description The member that owns this resource
Type MEMBER

Returns…

Description The answer.
Type boolean

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

boolean ocf_may_delete_topics_by(AUTO_LINK forum_id, MEMBER member_id, MEMBER resource_owner)

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

Parameters…

Name forum_id
Description The forum the topic would be in.
Type AUTO_LINK

Name member_id
Description The member checking access for.
Type MEMBER

Name resource_owner
Description The member that owns this resource
Type MEMBER

Returns…

Description The answer.
Type boolean

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

void ocf_ping_topic_read(AUTO_LINK topic_id, ?MEMBER member_id)

Mark a topic as read by the current member.

Parameters…

Name topic_id
Description The Id of the topic to mark as read.
Type AUTO_LINK

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

(No return value)


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

boolean ocf_has_read_topic(AUTO_LINK topic_id, ?TIME topic_last_time, ?MEMBER member_id, ?TIME member_last_time)

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

Parameters…

Name topic_id
Description The ID of the topic.
Type AUTO_LINK

Name topic_last_time
Description The time of the last post in the topic (NULL: get it from the DB).
Default value
Type ?TIME

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

Name member_last_time
Description The time the member last viewed the topic (NULL: get it from the DB).
Default value
Type ?TIME

Returns…

Description They have read it as such, yes.
Type boolean

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

boolean ocf_has_special_pt_access(AUTO_LINK topic_id, ?MEMBER member_id)

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

Parameters…

Name topic_id
Description The ID of the topic.
Type AUTO_LINK

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

Returns…

Description Whether they have special access.
Type boolean

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

sources/ocf_topics_action.php

Global_functions_ocf_topics_action.php

Function summary

AUTO_LINK ocf_make_topic (?AUTO_LINK forum_id, SHORT_TEXT description, SHORT_TEXT emoticon, ?BINARY validated, BINARY open, BINARY pinned, BINARY sunk, BINARY cascading, ?MEMBER pt_from, ?MEMBER pt_to, boolean check_perms, integer num_views, ?AUTO_LINK id, SHORT_TEXT description_link)

AUTO_LINK ocf_make_topic(?AUTO_LINK forum_id, SHORT_TEXT description, SHORT_TEXT emoticon, ?BINARY validated, BINARY open, BINARY pinned, BINARY sunk, BINARY cascading, ?MEMBER pt_from, ?MEMBER pt_to, boolean check_perms, integer num_views, ?AUTO_LINK id, SHORT_TEXT description_link)

Add a topic.

Parameters…

Name forum_id
Description The ID of the forum the topic will be in (NULL: Private Topic).
Type ?AUTO_LINK

Name description
Description Description of the topic.
Default value
Type SHORT_TEXT

Name emoticon
Description The theme image code of the emoticon for the topic.
Default value
Type SHORT_TEXT

Name validated
Description Whether the topic is validated (NULL: detect whether it should be).
Default value
Type ?BINARY

Name open
Description Whether the topic is open.
Default value 1
Type BINARY

Name pinned
Description Whether the topic is pinned.
Default value 0
Type BINARY

Name sunk
Description Whether the topic is sunk.
Default value 0
Type BINARY

Name cascading
Description Whether the topic is cascading.
Default value 0
Type BINARY

Name pt_from
Description If it is a Private Topic, who is it 'from' (NULL: not a Private Topic).
Default value
Type ?MEMBER

Name pt_to
Description If it is a Private Topic, who is it 'to' (NULL: not a Private Topic).
Default value
Type ?MEMBER

Name check_perms
Description Whether to check the poster has permissions for the given topic settings.
Default value boolean-true
Type boolean

Name num_views
Description The number of times the topic has been viewed.
Default value 0
Type integer

Name id
Description Force an ID (NULL: don't force an ID)
Default value
Type ?AUTO_LINK

Name description_link
Description Link related to the topic (e.g. link to view a ticket).
Default value
Type SHORT_TEXT

Returns…

Description The ID of the newly created topic.
Type AUTO_LINK

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