Wpum_Tokens::get_field_value( $user,  $field )


Parameters Parameters

$user

(Required)

$field

(Required)


Top ↑

Return Return

(mixed)


Source Source

File: src/integrations/wp-user-manager/tokens/wpum-tokens.php

	function get_field_value( $user, $field ) {
		switch ( $field ) {
			case 'user_firstname':
				$value = $user->user_firstname;
				break;
			case 'user_lastname':
				$value = $user->user_lastname;
				break;
			case 'user_email':
				$value = $user->user_email;
				break;
			case 'user_nickname':
				$value = get_user_meta( $user->ID, 'nickname', true );
				break;
			case 'user_website':
				$value = $user->user_url;
				break;
			case 'user_description':
				$value = get_user_meta( $user->ID, 'description', true );
				break;
			case 'user_displayname':
				$value = $user->display_name;
				break;
			case 'user_avatar':
				$value = carbon_get_user_meta( $user->ID, 'current_user_avatar' );
				break;
			case 'user_cover':
				$value = carbon_get_user_meta( $user->ID, 'user_cover' );
				break;
			default:
				global $wpdb;
				$field_id = $wpdb->get_var( "SELECT id FROM {$wpdb->prefix}wpum_fields WHERE type = '{$field}' LIMIT 0,1" );
				$value    = get_user_meta( $user->ID, WPUM()->field_meta->get_meta( $field_id, 'user_meta_key' ),
					true );
		}

		return $value;
	}