[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-messages/classes/ -> class-bp-messages-thread.php (summary)

BuddyPress Messages Classes.

File Size: 1079 lines (32 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

BP_Messages_Thread:: (20 methods):
  __construct()
  populate()
  mark_read()
  mark_unread()
  get_recipients()
  get_messages()
  get_recipients_for_thread()
  delete()
  get_current_threads_for_user()
  get_meta_query_sql()
  mark_as_read()
  mark_as_unread()
  get_total_threads_for_user()
  user_is_sender()
  get_last_sender()
  get_inbox_count()
  check_access()
  is_valid()
  get_recipient_links()
  update_tables()


Class: BP_Messages_Thread  - X-Ref

BuddyPress Message Thread class.

__construct( $thread_id = 0, $order = 'ASC', $args = array()   X-Ref
Constructor.

param: int    $thread_id          The message thread ID.
param: string $order              The order to sort the messages. Either 'ASC' or 'DESC'.
param: array  $args               {
since: 1.0.0
since: 10.0.0 Updated the `$args` with new paremeters.

populate( $thread_id = 0, $order = 'ASC', $args = array()   X-Ref
Populate method.

Used in the constructor.

param: int    $thread_id                   The message thread ID.
param: string $order                       The order to sort the messages. Either 'ASC' or 'DESC'.
param: array  $args                        {
return: bool False if there are no messages.
since: 1.0.0
since: 10.0.0 Updated the `$args` with new paremeters.

mark_read()   X-Ref
Mark a thread initialized in this class as read.

since: 1.0.0

mark_unread()   X-Ref
Mark a thread initialized in this class as unread.

since: 1.0.0

get_recipients( $thread_id = 0, $args = array()   X-Ref
Returns recipients for a message thread.

param: int   $thread_id Message thread ID.
param: array $args      {
return: array
since: 1.0.0
since: 2.3.0  Added `$thread_id` as a parameter.
since: 10.0.0 Added `$args` as a parameter.

get_messages( $thread_id = 0, $args = array()   X-Ref
Get messages associated with a thread.

param: int   $thread_id The message thread ID.
param: array $args      {
return: array
since: 2.3.0
since: 10.0.0 Added `$args` as a parameter.

get_recipients_for_thread( $thread_id = 0 )   X-Ref
Static method to get message recipients by thread ID.

param: int $thread_id The thread ID.
return: array
since: 2.3.0

delete( $thread_id = 0, $user_id = 0 )   X-Ref
Mark messages in a thread as deleted or delete all messages in a thread.

Note: All messages in a thread are deleted once every recipient in a thread
has marked the thread as deleted.

param: int $thread_id The message thread ID.
param: int $user_id The ID of the user in the thread to mark messages as
return: bool
since: 1.0.0
since: 2.7.0 The $user_id parameter was added. Previously the current user

get_current_threads_for_user( $args = array()   X-Ref
Get current message threads for a user.

param: array $args {
return: array|bool Array on success. Boolean false on failure.
since: 1.0.0

get_meta_query_sql( $meta_query = array()   X-Ref
Get the SQL for the 'meta_query' param in BP_Messages_Thread::get_current_threads_for_user().

We use WP_Meta_Query to do the heavy lifting of parsing the meta_query array
and creating the necessary SQL clauses.

param: array $meta_query An array of meta_query filters. See the
return: array $sql_array 'join' and 'where' clauses.
since: 2.2.0

mark_as_read( $thread_id = 0, $user_id = 0 )   X-Ref
Mark a thread as read.

param: int $thread_id The message thread ID.
param: int $user_id   The user the thread will be marked as read.
return: bool|int Number of threads marked as read or false on error.
since: 1.0.0
since: 9.0.0 Added the `user_id` parameter.

mark_as_unread( $thread_id = 0, $user_id = 0 )   X-Ref
Mark a thread as unread.

param: int $thread_id The message thread ID.
param: int $user_id   The user the thread will be marked as unread.
return: bool|int Number of threads marked as unread or false on error.
since: 1.0.0
since: 9.0.0 Added the `user_id` parameter.

get_total_threads_for_user( $user_id, $box = 'inbox', $type = 'all' )   X-Ref
Returns the total number of message threads for a user.

param: int    $user_id The user ID.
param: string $box     The type of mailbox to get. Either 'inbox' or 'sentbox'.
param: string $type    The type of messages to get. Either 'all' or 'unread'.
return: int Total thread count for the provided user.
since: 1.0.0

user_is_sender( $thread_id )   X-Ref
Determine if the logged-in user is a sender of any message in a thread.

param: int $thread_id The message thread ID.
return: bool
since: 1.0.0

get_last_sender( $thread_id )   X-Ref
Returns the userlink of the last sender in a message thread.

param: int $thread_id The message thread ID.
return: string|bool The user link on success. Boolean false on failure.
since: 1.0.0

get_inbox_count( $user_id = 0 )   X-Ref
Gets the unread message count for a user.

param: int $user_id The user ID.
return: int Total inbox unread count for user.
since: 1.0.0

check_access( $thread_id, $user_id = 0 )   X-Ref
Checks whether a user is a part of a message thread discussion.

param: int $thread_id The message thread ID.
param: int $user_id   The user ID. Default: ID of the logged-in user.
return: int|null The recorded recipient ID on success, null on failure.
since: 1.0.0

is_valid( $thread_id = 0 )   X-Ref
Checks whether a message thread exists.

param: int $thread_id The message thread ID.
return: bool|int|null The message thread ID on success, null on failure.
since: 1.0.0

get_recipient_links( $recipients )   X-Ref
Returns a string containing all the message recipient userlinks.

String is comma-delimited.

If a message thread has more than four users, the returned string is simply
"X Recipients" where "X" is the number of recipients in the message thread.

param: array $recipients Array containing the message recipients (array of objects).
return: string String of message recipent userlinks.
since: 1.0.0

update_tables()   X-Ref
Upgrade method for the older BP message thread DB table.

return: bool
since: 1.2.0



Generated: Sun Oct 17 01:00:58 2021 Cross-referenced by PHPXref 0.7.1