glFusion Wiki

Site Tools


glfusion:development:api:cmt:functions

lib-comment.php

CMT_commentBar

string CMT_commentBar( string $sid, string $title, string $type, string $order, string $mode, [int $ccode = 0])

This function displays the comment control bar

Prints the control that allows the user to interact with glFusion Comments

Parameters

string $sid ID of item in question
string $title Title of item
string $type Type of item (i.e. article, photo, etc)
string $order Order that comments are displayed in
string $mode Mode (nested, flat, etc.)
int $ccode Comment code: -1=no comments, 0=allowed, 1=closed

Return

HTML Formated comment bar

See Also

CMT_userComments()

CMT_commentForm

string CMT_commentForm( string $title, string $comment, string $sid, [int $pid = '0'], string $type, string $mode, string $postmode)

Displays the comment form

Parameters

string $title Title of comment
string $comment Text of comment
string $sid ID of object comment belongs to
int $pid ID of parent comment
string $type Type of object comment is posted to
string $mode Mode, e.g. 'preview'
string $postmode Indicates if comment is plain text or HTML

Return

HTML for comment form

CMT_deleteComment

string CMT_deleteComment( int $cid, string $sid, string $type)

Deletes a given comment

The function expects the calling function to check to make sure the requesting user has the correct permissions and that the comment exits for the specified $type and $sid.

Parameters

string $type article, poll, or plugin identifier
string $sid id of object comment belongs to
int $cid Comment ID

Return

0 indicates success, >0 identifies problem

CMT_getComment

string CMT_getComment( array &$comments, string $mode, string $type, string $order, [boolean $delete_option = false], [boolean $preview = false], [int $ccode = 0])

This function prints &$comments (db results set of comments) in comment format -For previews, &$comments is assumed to be an associative array containing data for a single comment.

Parameters

array &$comments Database result set of comments to be printed
string $mode 'flat', 'threaded', etc
string $type Type of item (article, poll, etc.)
string $order How to order the comments 'ASC' or 'DESC'
boolean $delete_option if current user can delete comments
boolean $preview Preview display (for edit) or not
int $ccode Comment code: -1=no comments, 0=allowed, 1=closed

Return

HTML Formated Comment

CMT_prepareText

string CMT_prepareText( string $comment, string $postmode, string $type, [bool $edit = false], [int $cid = null])

Filters comment text and appends necessary tags (sig and/or edit)

Parameters

string $comment comment text
string $postmode ('html', 'plaintext', …)
string $type Type of item (article, poll, etc.)
bool $edit if true append edit tag
int $cid commentid if editing comment (for proper sig)

Return

of comment text

CMT_reportAbusiveComment

string CMT_reportAbusiveComment( string $cid, string $type)

Display form to report abusive comment.

Parameters

string $cid comment id
string $type type of comment ('article', 'poll', …)

Return

HTML for the form (or error message)

CMT_saveComment

int CMT_saveComment( string $title, string $comment, string $sid, int $pid, string $type, string $postmode)

Save a comment

Parameters

string $title Title of comment
string $comment Text of comment
string $sid ID of object receiving comment
int $pid ID of parent comment
string $type Type of comment this is (article, polls, etc)
string $postmode Indicates if text is HTML or plain text

Return

-1 == queued, 0 == comment saved, > 0 indicates error

CMT_sendNotification

boolean CMT_sendNotification( $title $title, $comment $comment, $uid $uid, $username $username, $ipaddress $ipaddress, $type $type, $cid $cid)

Send an email notification for a new comment submission.

Parameters

$title $title string comment title
$comment $comment string text of the comment
$uid $uid int user id
$username $username string optional name of anonymous user
$ipaddress $ipaddress string poster's IP address
$type $type string type of comment ('article', 'poll', …)
$cid $cid int comment id (or 0 when in submission queue)

Return

true if successfully sent, otherwise false

CMT_sendReport

string CMT_sendReport( string $cid, string $type)

Send report about abusive comment

Parameters

string $cid comment id
string $type type of comment ('article', 'poll', …)

Return

Meta refresh or HTML for error message

CMT_updateCommentcodes

void CMT_updateCommentcodes( )

Disables comments for all stories where current time is past comment expire time and enables comments for certain number of most recent stories.

CMT_userComments

string CMT_userComments( string $sid, string $title, [string $type = 'article'], [string $order = ''], [string $mode = ''], [int $pid = 0], [int $page = 1], [boolean $cid = false], [boolean $delete_option = false], [int $ccode = 0])

This function displays the comments in a high level format.

Begins displaying user comments for an item

Parameters

string $sid ID for item to show comments for
string $title Title of item
string $type Type of item (article, poll, etc.)
string $order How to order the comments 'ASC' or 'DESC'
string $mode comment mode (nested, flat, etc.)
int $pid id of parent comment
int $page page number of comments to display
boolean $cid true if $pid should be interpreted as a cid instead
boolean $delete_option if current user can delete comments
int $ccode Comment code: -1=no comments, 0=allowed, 1=closed

Return

HTML Formated Comments

See Also

CMT_commentBar()

glfusion/development/api/cmt/functions.txt · Last modified: 2017/04/12 21:15 (external edit)

Page Tools