bp_get_email_subject

Retrieve a client friendly version of the root blog name.

Description

(string) bp_get_email_subject( (array) $args = array() ); 

The blogname option is escaped with esc_html on the way into the database in sanitize_option, we want to reverse this for the plain text arena of emails.

Returns (string)

Sanitized email subject.

Parameters (1)

0. $args — Optional. (array) => array()
Array of optional parameters.

Options

  • before (string) => ''

    String to appear before the site name in the email subject. Default: [..

  • after (string) => ''

    String to appear after the site name in the email subject. Default: ]..

  • default (string) => ''

    The default site name, to be used when none is found in the database. Default: Community..

array(

    /**
     * String to appear before the site name in the email subject. Default: '['.
     *
     * @type string
     * @default ''
     */
    'before' => '',

    /**
     * String to appear after the site name in the email subject. Default: ']'.
     *
     * @type string
     * @default ''
     */
    'after' => '',

    /**
     * The default site name, to be used when none is found in the database. Default: 'Community'.
     *
     * @type string
     * @default ''
     */
    'default' => ''
);        


Usage

  1. if ( !function_exists( 'bp_get_email_subject' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-template.php'; 
  3.  
  4. // Array of optional parameters. 
  5. $args = array( 
  6. 'before' => '', 
  7. 'after' => '', 
  8. 'default' => '' 
  9. ); 
  10.  
  11. // NOTICE! Understand what this does before running. 
  12. $result = bp_get_email_subject($args); 
  13.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-template.php  
  1. function bp_get_email_subject( $args = array() ) { 
  2.  
  3. $r = bp_parse_args( $args, array( 
  4. 'before' => '[',  
  5. 'after' => ']',  
  6. 'default' => __( 'Community', buddypress ),  
  7. 'text' => '' 
  8. ), 'get_email_subject' ); 
  9.  
  10. $subject = $r['before'] . wp_specialchars_decode( bp_get_option( 'blogname', $r['default'] ), ENT_QUOTES ) . $r['after'] . ' ' . $r['text']; 
  11.  
  12. /** 
  13. * Filters a client friendly version of the root blog name. 
  14. * @since 1.7.0 
  15. * @param string $subject Client friendy version of the root blog name. 
  16. * @param array $r Array of arguments for the email subject. 
  17. */ 
  18. return apply_filters( 'bp_get_email_subject', $subject, $r );