BP_XProfile_Field::get_type( int $field_id )

Get the type for provided field ID.

Description

Parameters

$field_id

(int) (Required) Field ID to get type of.

Return

(bool|null|string)

Source

File: bp-xprofile/classes/class-bp-xprofile-field.php

	public static function get_type( $field_id = 0 ) {
		global $wpdb;

		// Bail if no field ID.
		if ( empty( $field_id ) ) {
			return false;
		}

		$bp   = buddypress();
		$sql  = $wpdb->prepare( "SELECT type FROM {$bp->profile->table_name_fields} WHERE id = %d", $field_id );
		$type = $wpdb->get_var( $sql );

		// Return field type.
		if ( ! empty( $type ) ) {
			return $type;
		}

		return false;
	}

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.