Bdb_Tokens::get_profile_field_value( integer $user_id, string $piece = '' )

Method get_profile_field_value


Parameters Parameters

$user_id

(Required) The user id.

$piece

(Optional) The token piece.

Default value: ''


Top ↑

Return Return

(string) The profile field value. Comma separated list of values for multiple selection.


Source Source

File: src/integrations/buddyboss/tokens/bdb-tokens.php

	public function get_profile_field_value( $user_id = 0, $piece = '' ) {
		if ( ! function_exists( 'bp_get_profile_field_data' ) ) {
			return '';
		}
		$profile_field_value = bp_get_profile_field_data(
			array(
				'field'   => absint( $piece ),
				'user_id' => $user_id,
			)
		);
		// Checkbox
		if ( is_array( $profile_field_value ) ) {
			return implode( ', ', $profile_field_value );
		}
		return $profile_field_value;
	}