[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-messages/ -> bp-messages-functions.php (summary)

BuddyPress Messages Functions. Business functions are where all the magic happens in BuddyPress. They will handle the actual saving or manipulation of information. Usually they will hand off to a database class for data access, then return true or false on success or failure.

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

Defines 19 functions

  messages_new_message()
  messages_send_notice()
  messages_delete_thread()
  messages_check_thread_access()
  messages_mark_thread_read()
  messages_mark_thread_unread()
  messages_add_callback_values()
  messages_remove_callback_values()
  messages_get_unread_count()
  messages_is_user_sender()
  messages_get_message_sender()
  messages_is_valid_thread()
  messages_get_message_thread_id()
  bp_messages_delete_meta()
  bp_messages_get_meta()
  bp_messages_update_meta()
  bp_messages_add_meta()
  messages_notification_new_message()
  bp_messages_personal_data_exporter()

Functions
Functions that are not part of a class:

messages_new_message( $args = '' )   X-Ref
Create a new message.

since: 2.4.0 Added 'error_type' as an additional $args parameter.
return: int|bool|WP_Error ID of the message thread on success, false on failure.
param: array|string $args {

messages_send_notice( $subject, $message )   X-Ref
Send a notice.

return: bool True on success, false on failure.
param: string $subject Subject of the notice.
param: string $message Content of the notice.

messages_delete_thread( $thread_ids, $user_id = 0 )   X-Ref
Deletes message thread(s) for a given user.

Note that "deleting" a thread for a user means removing it from the user's
message boxes. A thread is not deleted from the database until it's been
"deleted" by all recipients.

since: 2.7.0 The $user_id parameter was added. Previously the current user
return: bool True on success, false on failure.
param: int|array $thread_ids Thread ID or array of thread IDs.
param: int       $user_id    ID of the user to delete the threads for. Defaults

messages_check_thread_access( $thread_id, $user_id = 0 )   X-Ref
Check whether a user has access to a thread.

return: int|null Message ID if the user has access, otherwise null.
param: int $thread_id ID of the thread.
param: int $user_id   Optional. ID of the user. Default: ID of the logged-in user.

messages_mark_thread_read( $thread_id )   X-Ref
Mark a thread as read.

Wrapper for {@link BP_Messages_Thread::mark_as_read()}.

return: false|int Number of threads marked as read or false on error.
param: int $thread_id ID of the thread.

messages_mark_thread_unread( $thread_id )   X-Ref
Mark a thread as unread.

Wrapper for {@link BP_Messages_Thread::mark_as_unread()}.

return: false|int Number of threads marked as unread or false on error.
param: int $thread_id ID of the thread.

messages_add_callback_values( $recipients, $subject, $content )   X-Ref
Set messages-related cookies.

Saves the 'bp_messages_send_to', 'bp_messages_subject', and
'bp_messages_content' cookies, which are used when setting up the default
values on the messages page.

param: string $recipients Comma-separated list of recipient usernames.
param: string $subject    Subject of the message.
param: string $content    Content of the message.

messages_remove_callback_values()   X-Ref
Unset messages-related cookies.


messages_get_unread_count( $user_id = 0 )   X-Ref
Get the unread messages count for a user.

return: int
param: int $user_id Optional. ID of the user. Default: ID of the logged-in user.

messages_is_user_sender( $user_id, $message_id )   X-Ref
Check whether a user is the sender of a message.

return: int|null Returns the ID of the message if the user is the
param: int $user_id    ID of the user.
param: int $message_id ID of the message.

messages_get_message_sender( $message_id )   X-Ref
Get the ID of the sender of a message.

return: int|null The ID of the sender if found, otherwise null.
param: int $message_id ID of the message.

messages_is_valid_thread( $thread_id )   X-Ref
Check whether a message thread exists.

return: false|int|null The message thread ID on success, null on failure.
param: int $thread_id ID of the thread.

messages_get_message_thread_id( $message_id = 0 )   X-Ref
Get the thread ID from a message ID.

since: 2.3.0
return: int The ID of the thread if found, otherwise 0.
param: int $message_id ID of the message.

bp_messages_delete_meta( $message_id, $meta_key = false, $meta_value = false, $delete_all = false )   X-Ref
Delete metadata for a message.

If $meta_key is false, this will delete all meta for the message ID.

since: 2.2.0
return: bool True on successful delete, false on failure.
param: int         $message_id ID of the message to have meta deleted for.
param: string|bool $meta_key   Meta key to delete. Default false.
param: string|bool $meta_value Meta value to delete. Default false.
param: bool        $delete_all Whether or not to delete all meta data.

bp_messages_get_meta( $message_id, $meta_key = '', $single = true )   X-Ref
Get a piece of message metadata.

since: 2.2.0
return: mixed
param: int    $message_id ID of the message to retrieve meta for.
param: string $meta_key   Meta key to retrieve. Default empty string.
param: bool   $single     Whether or not to fetch all or a single value.

bp_messages_update_meta( $message_id, $meta_key, $meta_value, $prev_value = '' )   X-Ref
Update a piece of message metadata.

since: 2.2.0
return: mixed
param: int         $message_id ID of the message to have meta deleted for.
param: string|bool $meta_key   Meta key to update.
param: string|bool $meta_value Meta value to update.
param: string      $prev_value If specified, only update existing metadata entries with

bp_messages_add_meta( $message_id, $meta_key, $meta_value, $unique = false )   X-Ref
Add a piece of message metadata.

since: 2.2.0
return: mixed
param: int         $message_id ID of the message to have meta deleted for.
param: string|bool $meta_key   Meta key to update.
param: string|bool $meta_value Meta value to update.
param: bool        $unique     Whether the specified metadata key should be

messages_notification_new_message( $raw_args = array()   X-Ref
Email message recipients to alert them of a new unread private message.

since: 1.0.0
param: array|BP_Messages_Message $raw_args {

bp_messages_personal_data_exporter( $email_address, $page )   X-Ref
Finds and exports personal data associated with an email address from the Messages tables.

since: 4.0.0
return: array An array of personal data.
param: string $email_address  The user's email address.
param: int    $page           Batch number.



Generated: Thu Sep 19 01:01:39 2019 Cross-referenced by PHPXref 0.7.1