Bp_Tokens::parse_bp_token( $value,  $pieces,  $recipe_id,  $trigger_data,  $user_id,  $replace_args )


Parameters Parameters

$value

(Required)

$pieces

(Required)

$recipe_id

(Required)

$trigger_data

(Required)


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/buddypress/tokens/bp-tokens.php

	public function parse_bp_token( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args ) {
		if ( $pieces ) {
			if ( in_array( 'BPUSERAVATAR', $pieces ) ) {
				// Get Group id from meta log
				if ( function_exists( 'get_avatar_url' ) ) {
					$value = get_avatar_url( $user_id );
				}
			} elseif ( in_array( 'BPXPROFILE', $pieces ) ) {

				if ( isset( $pieces[2] ) && ! empty( $pieces[2] ) ) {
					$value = $this->get_xprofile_data( $user_id, $pieces[2] );
				}
			} elseif ( in_array( 'BPUSERACTIVITY', $pieces ) ) {

				if ( $trigger_data ) {
					foreach ( $trigger_data as $trigger ) {
						$trigger_id     = $trigger['ID'];
						$trigger_log_id = $replace_args['trigger_log_id'];
						$meta_key       = $pieces[2];
						$meta_value     = Automator()->helpers->recipe->get_form_data_from_trigger_meta( $meta_key, $trigger_id, $trigger_log_id, $user_id );
						if ( ! empty( $meta_value ) ) {
							$value = $meta_value;
						}
					}
				}
			}
		}

		return $value;
	}