buddypress-group-email-subscription icon indicating copy to clipboard operation
buddypress-group-email-subscription copied to clipboard

Way to customize links on footer?

Open levycarneiro opened this issue 3 years ago • 2 comments

Is there a way to customize the links on the footer?

Screen Shot 2021-04-17 at 12 01 03 PM

Looking to customize the Text of these links.

Thanks.

levycarneiro avatar Apr 17 '21 15:04 levycarneiro

See the function ass_bp_email_footer_html_unsubscribe_links(). We generate the links dynamically, so you'll have to unhook this filter and introduce your own that does something similar. @r-a-y Am I understanding this correctly?

boonebgorges avatar Apr 19 '21 15:04 boonebgorges

See the function ass_bp_email_footer_html_unsubscribe_links(). We generate the links dynamically, so you'll have to unhook this filter and introduce your own that does something similar. @r-a-y Am I understanding this correctly?

Sorry. I didn't see this message until just now. Yes, that's correct.

To unhook the default footer links and roll your own, use the following:

add_action( 'bp_ges_before_bp_send_email', function() {
	// unhooks default GES email footer
	remove_action( 'bp_after_email_footer', 'ass_bp_email_footer_html_unsubscribe_links' );

	// add our custom email footer
	add_action( 'bp_after_email_footer', 'my_custom_email_footer' );
} );

function my_custom_email_footer() {
	$tokens = buddypress()->ges_tokens;

	// Bail if this isn't a group subscription email.
	if ( ! isset( $tokens['subscription_type'] ) ) {
		return;
	}

	// do your custom footer routine here.
	// to determine what type of email this is use: $tokens['subscription_type']
}

If you're just looking to customize the text, you should look into using a custom localization file (.pot file) or use the 'gettext' filter to change the strings.

r-a-y avatar Jul 07 '21 00:07 r-a-y