messages_send_notice( string $subject, string $message )
Send a notice.
Description
Parameters
- $subject
-
(Required) Subject of the notice.
- $message
-
(Required) Content of the notice.
Return
(bool) True on success, false on failure.
Source
File: bp-messages/bp-messages-functions.php
function messages_send_notice( $subject, $message ) {
if ( !bp_current_user_can( 'bp_moderate' ) || empty( $subject ) || empty( $message ) ) {
return false;
// Has access to send notices, lets do it.
} else {
$notice = new BP_Messages_Notice;
$notice->subject = $subject;
$notice->message = $message;
$notice->date_sent = bp_core_current_time();
$notice->is_active = 1;
$notice->save(); // Send it.
/**
* Fires after a notice has been successfully sent.
*
* @since BuddyPress 1.0.0
*
* @param string $subject Subject of the notice.
* @param string $message Content of the notice.
*/
do_action_ref_array( 'messages_send_notice', array( $subject, $message ) );
return true;
}
}
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.