messages_send_notice( string $subject, string $message )

Send a notice.


Parameters Parameters

$subject

(string) (Required) Subject of the notice.

$message

(string) (Required) Content of the notice.


Top ↑

Return Return

(bool) True on success, false on failure.


Source 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 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;
	}
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.