Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
mod_forum\local\entities\post Class Reference

Post class. More...

Public Member Functions

 __construct (int $id, int $discussionid, int $parentid, int $authorid, int $timecreated, int $timemodified, bool $mailed, string $subject, string $message, int $messageformat, bool $messagetrust, bool $hasattachments, int $totalscore, bool $mailnow, bool $deleted, int $privatereplyto, ?int $wordcount, ?int $charcount)
 Constructor.
 
 get_age ()
 Get the post's age in seconds.
 
 get_author_id ()
 Get the id of the user that authored the post.
 
 get_charcount ()
 Returns the char count.
 
 get_discussion_id ()
 Get the discussion id.
 
 get_id ()
 Get the post id.
 
 get_message ()
 Get the post message.
 
 get_message_format ()
 Get the post message format.
 
 get_parent_id ()
 Get the id of the parent post.
 
 get_private_reply_recipient_id ()
 Get the id of the user that this post was intended for.
 
 get_subject ()
 Get the post subject.
 
 get_time_created ()
 Get the timestamp for when this post was created.
 
 get_time_modified ()
 Get the timestamp for when this post was last modified.
 
 get_total_score ()
 Get the total score.
 
 get_wordcount ()
 Returns the word count.
 
 has_attachments ()
 Does this post have attachments?
 
 has_been_mailed ()
 Has this post been mailed?
 
 has_parent ()
 Does this post have a parent? I.e.
 
 is_deleted ()
 Is this post deleted?
 
 is_message_trusted ()
 Is this a trusted message? I.e.
 
 is_owned_by_user (stdClass $user)
 Check if the given user authored this post.
 
 is_private_reply ()
 Is this post private?
 
 is_private_reply_intended_for_user (stdClass $user)
 Check if the given post is a private reply intended for the given user.
 
 should_mail_now ()
 Should this post be mailed now?
 

Static Public Member Functions

static add_message_counts (\stdClass $record)
 This methods adds/updates forum posts' word count and char count attributes based on $data->message.
 

Detailed Description

Post class.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

mod_forum\local\entities\post::__construct ( int $id,
int $discussionid,
int $parentid,
int $authorid,
int $timecreated,
int $timemodified,
bool $mailed,
string $subject,
string $message,
int $messageformat,
bool $messagetrust,
bool $hasattachments,
int $totalscore,
bool $mailnow,
bool $deleted,
int $privatereplyto,
?int $wordcount,
?int $charcount )

Constructor.

Parameters
int$idID
int$discussionidThe id of the discussion this post belongs to
int$parentidThe id of the post that this post is replying to. Zero if it isn't a reply.
int$authoridThe id of user who authored the post
int$timecreatedTimestamp for when the post was created
int$timemodifiedTimestamp for when the post last modified
bool$mailedIf the post has been mailed
string$subjectPost subject
string$messagePost message
int$messageformatFormat of the post message
bool$messagetrustIs this a trusted message, i.e. created by a trusted user.
bool$hasattachmentsDoes the post have attachments
int$totalscoreTotal score
bool$mailnowShould this post be mailed immediately
bool$deletedIs the post deleted
int$privatereplytoWhich user this reply is intended for in a private reply situation

Member Function Documentation

◆ add_message_counts()

static mod_forum\local\entities\post::add_message_counts ( \stdClass $record)
static

This methods adds/updates forum posts' word count and char count attributes based on $data->message.

Parameters
stdClass$recordA record ready to be inserted / updated in DB.
Return values
void.

◆ get_age()

mod_forum\local\entities\post::get_age ( )

Get the post's age in seconds.

Return values
int

◆ get_author_id()

mod_forum\local\entities\post::get_author_id ( )

Get the id of the user that authored the post.

Return values
int

◆ get_charcount()

mod_forum\local\entities\post::get_charcount ( )

Returns the char count.

Return values
int|null

◆ get_discussion_id()

mod_forum\local\entities\post::get_discussion_id ( )

Get the discussion id.

Return values
int

◆ get_id()

mod_forum\local\entities\post::get_id ( )

Get the post id.

Return values
int

◆ get_message()

mod_forum\local\entities\post::get_message ( )

Get the post message.

Return values
string

◆ get_message_format()

mod_forum\local\entities\post::get_message_format ( )

Get the post message format.

Return values
int

◆ get_parent_id()

mod_forum\local\entities\post::get_parent_id ( )

Get the id of the parent post.

Returns zero if this post is not a reply.

Return values
int

◆ get_private_reply_recipient_id()

mod_forum\local\entities\post::get_private_reply_recipient_id ( )

Get the id of the user that this post was intended for.

Return values
int

◆ get_subject()

mod_forum\local\entities\post::get_subject ( )

Get the post subject.

Return values
string

◆ get_time_created()

mod_forum\local\entities\post::get_time_created ( )

Get the timestamp for when this post was created.

Return values
int

◆ get_time_modified()

mod_forum\local\entities\post::get_time_modified ( )

Get the timestamp for when this post was last modified.

Return values
int

◆ get_total_score()

mod_forum\local\entities\post::get_total_score ( )

Get the total score.

Return values
int

◆ get_wordcount()

mod_forum\local\entities\post::get_wordcount ( )

Returns the word count.

Return values
int|null

◆ has_attachments()

mod_forum\local\entities\post::has_attachments ( )

Does this post have attachments?

Return values
bool

◆ has_been_mailed()

mod_forum\local\entities\post::has_been_mailed ( )

Has this post been mailed?

Return values
bool

◆ has_parent()

mod_forum\local\entities\post::has_parent ( )

Does this post have a parent? I.e.

is it a reply?

Return values
bool

◆ is_deleted()

mod_forum\local\entities\post::is_deleted ( )

Is this post deleted?

Return values
bool

◆ is_message_trusted()

mod_forum\local\entities\post::is_message_trusted ( )

Is this a trusted message? I.e.

was it authored by a trusted user?

Return values
bool

◆ is_owned_by_user()

mod_forum\local\entities\post::is_owned_by_user ( stdClass $user)

Check if the given user authored this post.

Parameters
stdClass$userThe user to check.
Return values
bool

◆ is_private_reply()

mod_forum\local\entities\post::is_private_reply ( )

Is this post private?

Return values
bool

◆ is_private_reply_intended_for_user()

mod_forum\local\entities\post::is_private_reply_intended_for_user ( stdClass $user)

Check if the given post is a private reply intended for the given user.

Parameters
stdClass$userThe user to check.
Return values
bool

◆ should_mail_now()

mod_forum\local\entities\post::should_mail_now ( )

Should this post be mailed now?

Return values
bool

The documentation for this class was generated from the following file: