[ Index ] |
PHP Cross Reference of BuddyPress |
[Source view] [Print] [Project Stats]
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: | 866 lines (27 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
messages_new_message( $args = '' ) X-Ref |
Create a new message. return: int|bool|WP_Error ID of the message thread on success, false on failure. param: array|string $args { since: 2.4.0 Added 'error_type' as an additional $args parameter. |
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. 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 since: 2.7.0 The $user_id parameter was added. Previously the current user |
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, $user_id = 0 ) 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 The message thread ID. param: int $user_id Optional. The user the thread will be marked as read. since: 9.0.0 Added the `user_id` parameter. |
messages_mark_thread_unread( $thread_id, $user_id = 0 ) 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 The message thread ID. param: int $user_id Optional. The user the thread will be marked as unread. since: 9.0.0 Added the `user_id` parameter. |
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. return: int The ID of the thread if found, otherwise 0. param: int $message_id ID of the message. since: 2.3.0 |
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. 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. since: 2.2.0 |
bp_messages_get_meta( $message_id, $meta_key = '', $single = true ) X-Ref |
Get a piece of message metadata. 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. since: 2.2.0 |
bp_messages_update_meta( $message_id, $meta_key, $meta_value, $prev_value = '' ) X-Ref |
Update a piece of message metadata. 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 since: 2.2.0 |
bp_messages_add_meta( $message_id, $meta_key, $meta_value, $unique = false ) X-Ref |
Add a piece of message metadata. 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 since: 2.2.0 |
messages_notification_new_message( $raw_args = array() X-Ref |
Email message recipients to alert them of a new unread private message. param: array|BP_Messages_Message $raw_args { since: 1.0.0 |
bp_messages_personal_data_exporter( $email_address, $page ) X-Ref |
Finds and exports personal data associated with an email address from the Messages tables. return: array An array of personal data. param: string $email_address The user's email address. param: int $page Batch number. since: 4.0.0 |
bp_messages_dismiss_sitewide_notice( $user_id = 0, $notice_id = 0 ) X-Ref |
Dismiss a sitewide notice for a user. return: bool False on failure, true if notice is dismissed param: int $user_id ID of the user to dismiss the notice for. param: int $notice_id ID of the notice to be dismissed. since: 9.0.0 |
bp_messages_exit_thread( $thread_ids, $user_id = 0 ) X-Ref |
Exit one or more message thread(s) for a given 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 since: 10.0.0 |
Generated: Thu Nov 21 01:00:57 2024 | Cross-referenced by PHPXref 0.7.1 |