bp_get_member_invitation_message()

Returns the body content of invite email.

Description

Return

(string)

Source

File: bp-invites/bp-invites-functions.php

function bp_get_member_invitation_message() {
	global $bp;

	$term = get_term_by('name', 'invites-member-invite', bp_get_email_tax_type() );

	$args = array(
		'post_type' => bp_get_email_post_type(),
		'tax_query' => array(
			array(
				'taxonomy' => bp_get_email_tax_type(),
				'field' => 'term_id',
				'terms' => $term->term_id
			)
		)
	);
	$query = new WP_Query( $args );

	$wp_html_emails    = null;
	$is_default_wpmail = null;

	// Has wp_mail() been filtered to send HTML emails?
	if ( is_null( $wp_html_emails ) ) {
		/** This filter is documented in wp-includes/pluggable.php */
		$wp_html_emails = apply_filters( 'wp_mail_content_type', 'text/plain' ) === 'text/html';
	}

	// Since wp_mail() is a pluggable function, has it been re-defined by another plugin?
	if ( is_null( $is_default_wpmail ) ) {
		try {
			$mirror            = new ReflectionFunction( 'wp_mail' );
			$is_default_wpmail = substr( $mirror->getFileName(), -strlen( 'pluggable.php' ) ) === 'pluggable.php';
		} catch ( Exception $e ) {
			$is_default_wpmail = true;
		}
	}

	$must_use_wpmail = apply_filters( 'bp_email_use_wp_mail', $wp_html_emails || ! $is_default_wpmail );

	if ( $must_use_wpmail ) {
		$text =  $query->posts[0]->post_excerpt;
	} else {
		$text =  $query->posts[0]->post_content;
	}

	return apply_filters( 'bp_get_member_invitation_message', stripslashes( $text ) );
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.