BP_Email_Tokens::set_tokens( array $formatted_tokens, array $tokens, BP_Email $bp_email )
Set email tokens
Description
Parameters
- $formatted_tokens
-
(Required)
- $tokens
-
(Required)
- $bp_email
-
(Required)
Return
(array)
Source
File: bp-core/classes/class-bp-email-tokens.php
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | function set_tokens( $formatted_tokens , $tokens , $bp_email ) { if ( 'html' == $bp_email ->get_content_type() ) { $email_content = $bp_email ->get_content_html(); $all_tokens = $this ->get_tokens(); if ( ! empty ( $all_tokens ) ) { foreach ( $all_tokens as $token_key => $token_details ) { if ( strpos ( $email_content , $token_key ) !== false ) { $token_output = call_user_func( $token_details [ 'function' ], $bp_email , $formatted_tokens , $tokens ); $formatted_tokens [ sanitize_text_field( $token_key ) ] = $token_output ; } } } } return $formatted_tokens ; } |
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.