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 posts

» Return to Contents



sources/ocf_posts.php

Global_functions_ocf_posts.php

Function summary

void init__ocf_posts ()
boolean ocf_may_post_in_topic (AUTO_LINK forum_id, AUTO_LINK topic_id, ?MEMBER last_member_id, ?MEMBER member_id)
boolean ocf_may_edit_post_by (MEMBER resource_owner, ?AUTO_LINK forum_id, ?MEMBER member_id)
boolean ocf_may_delete_post_by (MEMBER resource_owner, ?AUTO_LINK forum_id, ?MEMBER member_id)
array ocf_display_spacer_post (ID_TEXT linked_type, ID_TEXT linked_id)

void init__ocf_posts()

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

boolean ocf_may_post_in_topic(AUTO_LINK forum_id, AUTO_LINK topic_id, ?MEMBER last_member_id, ?MEMBER member_id)

Find whether a member may post in a certain topic.

Parameters…

Name forum_id
Description The forum ID of the forum the topic is in.
Type AUTO_LINK

Name topic_id
Description The topic ID is in.
Type AUTO_LINK

Name last_member_id
Description The last poster in the topic (NULL: do not check for double posting).
Default value
Type ?MEMBER

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_post_by(MEMBER resource_owner, ?AUTO_LINK forum_id, ?MEMBER member_id)

Find whether a member may edit the detailed post.

Parameters…

Name resource_owner
Description The owner of the post.
Type MEMBER

Name forum_id
Description The forum the post is in (NULL: is a Private 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_delete_post_by(MEMBER resource_owner, ?AUTO_LINK forum_id, ?MEMBER member_id)

Find whether a member may delete the detailed post.

Parameters…

Name resource_owner
Description The owner of the post.
Type MEMBER

Name forum_id
Description The forum the post is in (NULL: is a Private 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

array ocf_display_spacer_post(ID_TEXT linked_type, ID_TEXT linked_id)

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

Parameters…

Name linked_type
Description Content type.
Type ID_TEXT

Name linked_id
Description Content ID.
Type ID_TEXT

Returns…

Description A pair: better description (may be NULL), better post (may be NULL).
Type array

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

sources/ocf_posts_action.php

Global_functions_ocf_posts_action.php

Function summary

void init__ocf_posts_action ()
?array ocf_check_post (LONG_TEXT post, ?AUTO_LINK topic_id, ?MEMBER poster)
AUTO_LINK ocf_make_post (AUTO_LINK topic_id, SHORT_TEXT title, LONG_TEXT post, BINARY skip_sig, boolean is_starter, ?BINARY validated, BINARY is_emphasised, ?string poster_name_if_guest, ?IP ip_address, ?TIME time, ?MEMBER poster, ?MEMBER intended_solely_for, ?TIME last_edit_time, ?MEMBER last_edit_by, boolean check_permissions, boolean update_cacheing, ?AUTO_LINK forum_id, boolean support_attachments, ?string topic_title, BINARY sunk, ?AUTO_LINK id, boolean anonymous, boolean skip_post_checks, boolean is_pt, boolean insert_comcode_as_admin, ?AUTO_LINK parent_id)
void ocf_force_update_member_post_count (MEMBER member_id, ?integer member_post_count_dif)
void ocf_decache_ocp_blocks (AUTO_LINK updated_forum_id, ?string forum_name, ?MEMBER member)

void init__ocf_posts_action()

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_check_post(LONG_TEXT post, ?AUTO_LINK topic_id, ?MEMBER poster)

Check a post would be valid.

Parameters…

Name post
Description The post.
Type LONG_TEXT

Name topic_id
Description The ID of the topic the post would be in (NULL: don't check with regard to any particular topic).
Default value
Type ?AUTO_LINK

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

Returns…

Description Row of the existing post if a double post (single row map-element in a list of rows) (NULL: not a double post).
Type ?array

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

AUTO_LINK ocf_make_post(AUTO_LINK topic_id, SHORT_TEXT title, LONG_TEXT post, BINARY skip_sig, boolean is_starter, ?BINARY validated, BINARY is_emphasised, ?string poster_name_if_guest, ?IP ip_address, ?TIME time, ?MEMBER poster, ?MEMBER intended_solely_for, ?TIME last_edit_time, ?MEMBER last_edit_by, boolean check_permissions, boolean update_cacheing, ?AUTO_LINK forum_id, boolean support_attachments, ?string topic_title, BINARY sunk, ?AUTO_LINK id, boolean anonymous, boolean skip_post_checks, boolean is_pt, boolean insert_comcode_as_admin, ?AUTO_LINK parent_id)

Add a post.

Parameters…

Name topic_id
Description The ID of the topic to add the post to.
Type AUTO_LINK

Name title
Description The title of the post (may be blank).
Type SHORT_TEXT

Name post
Description The post.
Type LONG_TEXT

Name skip_sig
Description Whether to skip showing the posters signature in the post.
Default value 0
Type BINARY

Name is_starter
Description Whether the post is the first in the topic.
Default value boolean-false
Type boolean

Name validated
Description Whether the post is validated (NULL: unknown, find whether it needs to be marked unvalidated initially).
Default value
Type ?BINARY

Name is_emphasised
Description Whether the post is marked emphasised.
Default value 0
Type BINARY

Name poster_name_if_guest
Description The name of the person making the post (NULL: username of current member).
Default value
Type ?string

Name ip_address
Description The IP address the post is to be made under (NULL: IP of current user).
Default value
Type ?IP

Name time
Description The time of the post (NULL: now).
Default value
Type ?TIME

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

Name intended_solely_for
Description The member that this post is intended solely for (NULL: public).
Default value
Type ?MEMBER

Name last_edit_time
Description The last edit time of the post (NULL: never edited).
Default value
Type ?TIME

Name last_edit_by
Description The member that was last to edit the post (NULL: never edited).
Default value
Type ?MEMBER

Name check_permissions
Description Whether to check permissions for whether the post may be made as it is given.
Default value boolean-true
Type boolean

Name update_cacheing
Description Whether to update the caches after making the post.
Default value boolean-true
Type boolean

Name forum_id
Description The forum the post will be in (NULL: find out from the DB).
Default value
Type ?AUTO_LINK

Name support_attachments
Description Whether to allow attachments in this post.
Default value boolean-true
Type boolean

Name topic_title
Description The title of the topic (NULL: find from the DB).
Default value
Type ?string

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

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

Name anonymous
Description Whether to make the post anonymous
Default value boolean-false
Type boolean

Name skip_post_checks
Description Whether to skip post checks
Default value boolean-false
Type boolean

Name is_pt
Description Whether this is for a new Private Topic
Default value boolean-false
Type boolean

Name insert_comcode_as_admin
Description Whether to explicitly insert the Comcode with admin privileges
Default value boolean-false
Type boolean

Name parent_id
Description Parent post ID (NULL: none-threaded/root-of-thread)
Default value
Type ?AUTO_LINK

Returns…

Description The ID of the new post.
Type AUTO_LINK

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

void ocf_force_update_member_post_count(MEMBER member_id, ?integer member_post_count_dif)

Force a members post count to be recalculated.

Parameters…

Name member_id
Description The member.
Type MEMBER

Name member_post_count_dif
Description The amount to add to the post count (NULL: fully recalculate the post count).
Default value
Type ?integer

(No return value)


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

void ocf_decache_ocp_blocks(AUTO_LINK updated_forum_id, ?string forum_name, ?MEMBER member)

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

Parameters…

Name updated_forum_id
Description The ID of the forum.
Type AUTO_LINK

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

Name member
Description The member (NULL: do no member decacheing).
Default value
Type ?MEMBER

(No return value)


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