[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/classes/ -> class-bp-email.php (summary)

Core component classes.

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

Defines 1 class

BP_Email:: (31 methods):
  __construct()
  get()
  get_preheader()
  get_headers()
  get_bcc()
  get_cc()
  get_content()
  get_content_html()
  get_content_plaintext()
  get_content_type()
  get_from()
  get_post_object()
  get_reply_to()
  get_subject()
  get_template()
  get_to()
  get_tokens()
  set_headers()
  set_bcc()
  set_cc()
  set_content_html()
  set_content_plaintext()
  set_content_type()
  set_from()
  set_post_object()
  set_reply_to()
  set_subject()
  set_template()
  set_to()
  set_tokens()
  validate()


Class: BP_Email  - X-Ref

Represents an email that will be sent to member(s).

__construct( $email_type )   X-Ref
Constructor.

Set the email type and default "from" and "reply to" name and address.

since: 2.5.0
param: string $email_type Unique identifier for a particular type of email.

get( $property_name, $transform = 'raw' )   X-Ref
Getter function to expose object properties.

Unlike most other methods in this class, this one is not chainable.

return: mixed Returns null if property does not exist, otherwise the value.
since: 2.5.0
param: string $property_name Property to access.
param: string $transform Optional. How to transform the return value.

get_preheader()   X-Ref
Get email preheader.

since: 4.0.0

get_headers( $transform = 'raw' )   X-Ref
Get email headers.

Unlike most other methods in this class, this one is not chainable.

return: string[] Associative pairing of email header name/value.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_bcc( $transform = 'raw' )   X-Ref
Get the email's "bcc" address and name.

Unlike most other methods in this class, this one is not chainable.

return: BP_Email_Recipient[] BCC recipients.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_cc( $transform = 'raw' )   X-Ref
Get the email's "cc" address and name.

Unlike most other methods in this class, this one is not chainable.

return: BP_Email_Recipient[] CC recipients.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_content( $transform = 'raw' )   X-Ref
Get the email content.

HTML or plaintext is returned, depending on the email's $content_type.
Unlike most other methods in this class, this one is not chainable.

return: string HTML or plaintext, depending on $content_type.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_content_html( $transform = 'raw' )   X-Ref
Get the email content (in HTML).

Unlike most other methods in this class, this one is not chainable.

return: string HTML email content.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_content_plaintext( $transform = 'raw' )   X-Ref
Get the email content (in plaintext).

Unlike most other methods in this class, this one is not chainable.

return: string Plain text email content.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_content_type( $transform = 'raw' )   X-Ref
Get the email content type (HTML or plain text) that the email will be sent in.

Unlike most other methods in this class, this one is not chainable.

return: string Email content type ("html" or "plaintext").
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_from( $transform = 'raw' )   X-Ref
Get the email's "from" address and name.

Unlike most other methods in this class, this one is not chainable.

return: BP_Email_Sender "From" recipient.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_post_object( $transform = 'raw' )   X-Ref
Get the Post associated with the email.

Unlike most other methods in this class, this one is not chainable.

return: WP_Post The post.
since: 2.5.0

get_reply_to( $transform = 'raw' )   X-Ref
Get the email's "reply to" address and name.

Unlike most other methods in this class, this one is not chainable.

return: BP_Email_Recipient "Reply to" recipient.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_subject( $transform = 'raw' )   X-Ref
Get the email subject.

Unlike most other methods in this class, this one is not chainable.

return: string Email subject.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_template( $transform = 'raw' )   X-Ref
Get the email template (the HTML wrapper around the email content).

Unlike most other methods in this class, this one is not chainable.

return: string Email template. Assumed to be HTML.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_to( $transform = 'raw' )   X-Ref
Get the email's "to" address and name.

Unlike most other methods in this class, this one is not chainable.

return: BP_Email_Recipient[] "To" recipients.
since: 2.5.0
param: string $transform Optional. How to transform the return value.

get_tokens( $transform = 'raw' )   X-Ref
Get token names and replacement values for this email.

Unlike most other methods in this class, this one is not chainable.

return: string[] Associative pairing of token name (key) and replacement value (value).
since: 2.5.0
param: string $transform Optional. How to transform the return value.

set_headers( array $headers )   X-Ref
Set email headers.

Does NOT let you override to/from, etc. Use the methods provided to set those.

return: BP_Email
since: 2.5.0
param: string[] $headers Key/value pairs of header name/values (strings).

set_bcc( $bcc_address, $name = '', $operation = 'replace' )   X-Ref
Set the email's "bcc" address and name.

To set a single address, the first parameter is the address and the second the name.
You can also pass a user ID or a WP_User object.

To set multiple addresses, for each array item, the key is the email address and
the value is the name.

return: BP_Email
since: 2.5.0
param: string|array|int|WP_User $bcc_address Either a email address, user ID, WP_User object,
param: string $name Optional. If $bcc_address is a string, this is the recipient's name.
param: string $operation Optional. If "replace", $to_address replaces current setting (default).

set_cc( $cc_address, $name = '', $operation = 'replace' )   X-Ref
Set the email's "cc" address and name.

To set a single address, the first parameter is the address and the second the name.
You can also pass a user ID or a WP_User object.

To set multiple addresses, for each array item, the key is the email address and
the value is the name.

return: BP_Email
since: 2.5.0
param: string|array|int|WP_User $cc_address Either a email address, user ID, WP_User object,
param: string $name Optional. If $cc_address is a string, this is the recipient's name.
param: string $operation Optional. If "replace", $to_address replaces current setting (default).

set_content_html( $content )   X-Ref
Set the email content (HTML).

return: BP_Email
since: 2.5.0
param: string $content HTML email content.

set_content_plaintext( $content )   X-Ref
Set the email content (plain text).

return: BP_Email
since: 2.5.0
param: string $content Plain text email content.

set_content_type( $content_type )   X-Ref
Set the content type (HTML or plain text) to send the email in.

return: BP_Email
since: 2.5.0
param: string $content_type Email content type ("html" or "plaintext").

set_from( $email_address, $name = '' )   X-Ref
Set the email's "from" address and name.

return: BP_Email
since: 2.5.0
param: string|array|int|WP_User $email_address Either a email address, user ID, or WP_User object.
param: string $name Optional. If $email_address is a string, this is the recipient's name.

set_post_object( WP_Post $post )   X-Ref
Set the Post object containing the email content template.

Also sets the email's subject, content, and template from the Post, for convenience.

return: BP_Email
since: 2.5.0
param: WP_Post $post

set_reply_to( $email_address, $name = '' )   X-Ref
Set the email's "reply to" address and name.

return: BP_Email
since: 2.5.0
param: string|array|int|WP_User $email_address Either a email address, user ID, WP_User object,
param: string $name Optional. If $email_address is a string, this is the recipient's name.

set_subject( $subject )   X-Ref
Set the email subject.

return: BP_Email
since: 2.5.0
param: string $subject Email subject.

set_template( $template )   X-Ref
Set the email template (the HTML wrapper around the email content).

This needs to include the string "{{{content}}}" to have the post content added
when the email template is rendered.

return: BP_Email
since: 2.5.0
param: string $template Email template. Assumed to be HTML.

set_to( $to_address, $name = '', $operation = 'replace' )   X-Ref
Set the email's "to" address and name.

IMPORTANT NOTE: the assumption with all emails sent by (and belonging to) BuddyPress itself
is that there will only be a single `$to_address`. This is to simplify token and templating
logic (for example, if multiple recipients, the "unsubscribe" link in the emails will all
only link to the first recipient).

To set a single address, the first parameter is the address and the second the name.
You can also pass a user ID or a WP_User object.

To set multiple addresses, for each array item, the key is the email address and
the value is the name.

return: BP_Email
since: 2.5.0
param: string|array|int|WP_User $to_address Either a email address, user ID, WP_User object,
param: string $name Optional. If $to_address is a string, this is the recipient's name.
param: string $operation Optional. If "replace", $to_address replaces current setting (default).

set_tokens( array $tokens )   X-Ref
Set token names and replacement values for this email.

In templates, tokens are inserted with a Handlebars-like syntax, e.g. `{{token_name}}`.
{ and } are reserved characters. There's no need to specify these brackets in your token names.

return: BP_Email
since: 2.5.0
param: string[] $tokens Associative array, contains key/value pairs of token name/value.

validate()   X-Ref
Check that we'd be able to send this email.

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.
since: 2.5.0



Generated: Wed Dec 11 01:01:37 2019 Cross-referenced by PHPXref 0.7.1