BP_XProfile_Field::get_type( int $field_id )

Get the type for provided field ID.


Description Description


Parameters Parameters

$field_id

(Required) Field ID to get type of.


Top ↑

Return Return

(bool|null|string)


Top ↑

Source 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;
	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.