xprofile_delete_field_data( string $field = '', int $user_id )

Delete XProfile field data.


Description Description


Parameters Parameters

$field

(Optional) Field to delete.

Default value: ''

$user_id

(Required) User ID to delete field from.


Top ↑

Return Return

(bool) Whether or not the field was deleted.


Top ↑

Source Source

File: bp-xprofile/bp-xprofile-functions.php

function xprofile_delete_field_data( $field = '', $user_id = 0 ) {

	// Get the field ID.
	if ( is_numeric( $field ) ) {
		$field_id = (int) $field;
	} else {
		$field_id = xprofile_get_field_id_from_name( $field );
	}

	// Bail if field or user ID are empty.
	if ( empty( $field_id ) || empty( $user_id ) ) {
		return false;
	}

	// Get the profile field data to delete.
	$field = new BP_XProfile_ProfileData( $field_id, $user_id );

	// Delete the field data.
	return $field->delete();
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.1.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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