BP_Email::validate()
Check that we’d be able to send this email.
Description
Unlike most other methods in this class, this one is not chainable.
Return
(bool|WP_Error) Returns true if validation succesful, else a descriptive WP_Error.
Source
File: bp-core/classes/class-bp-email.php
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | public function validate() { $retval = true; // BCC, CC, and token properties are optional. if ( ! $this ->get_from() || ! $this ->get_to() || ! $this ->get_subject() || ! $this ->get_content() || ! $this ->get_template() ) { $retval = new WP_Error( 'missing_parameter' , __CLASS__ , $this ); } /** * Filters whether the email passes basic validation checks. * * @since BuddyPress 2.5.0 * * @param bool|WP_Error $retval Returns true if validation succesful, else a descriptive WP_Error. * @param BP_Email $this Current instance of the email type class. */ return apply_filters( 'bp_email_validate' , $retval , $this ); } |
Changelog
Version | Description |
---|---|
BuddyPress 2.5.0 | Introduced. |
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.