bp_get_member_invites_wildcard_replace( $text, bool $email = false )

Replaces the token, {{ }}, to it’s appropriate content dynamically.

Description

Parameters

$text

(Required)

$email

(Optional)

Default value: false

Return

(string)

Source

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

function bp_get_member_invites_wildcard_replace( $text, $email = false ) {
	global $bp;

	$inviter_name = bp_core_get_user_displayname( bp_loggedin_user_id() );
	$site_name    = get_bloginfo( 'name' );
	$inviter_url  = bp_loggedin_user_domain();

	$email = urlencode( $email );

	$accept_link  = add_query_arg( array(
		'bp-invites' => 'accept-member-invitation',
		'email'    => $email,
	), bp_get_root_domain() . '/' . bp_get_signup_slug() . '/' );
	$accept_link  = apply_filters( 'bp_member_invitation_accept_url', $accept_link );

	/**
	 * @todo why are we using %% instead of {{ }} or {{{ }}}?
	 * Also, why are we using all caps, also why aren't we using . as separators?
	 */
	
	$text = str_replace( '{{inviter.name}}', $inviter_name, $text );
	$text = str_replace( '[{{{site.name}}}]', get_bloginfo('name'), $text );
	$text = str_replace( '{{{site.url}}}', site_url(), $text );
	$text = str_replace( '%%INVITERNAME%%', $inviter_name, $text );
	$text = str_replace( '%%INVITERURL%%', $inviter_url, $text );
	// @todo Don't we already have site.name above?
	$text = str_replace( '%%SITENAME%%', $site_name, $text );
	$text = str_replace( '%%ACCEPTURL%%', $accept_link, $text );

	/* Adding single % replacements because lots of people are making the mistake */
	$text = str_replace( '%INVITERNAME%', $inviter_name, $text );
	$text = str_replace( '%INVITERURL%', $inviter_url, $text );
	$text = str_replace( '%SITENAME%', $site_name, $text );
	$text = str_replace( '%ACCEPTURL%', $accept_link, $text );

	return $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.