bp_xprofile_update_meta( int $object_id, string $object_type, string $meta_key, string $meta_value, mixed $prev_value = '' )

Update a piece of xprofile metadata.


Description Description


Parameters Parameters

$object_id

(Required) ID of the object the metadata belongs to.

$object_type

(Required) Type of object. 'group', 'field', or 'data'.

$meta_key

(Required) Key of the metadata being updated.

$meta_value

(Required) Value of the metadata being updated.

$prev_value

(Optional) If specified, only update existing metadata entries with the specified value. Otherwise update all entries.

Default value: ''


Top ↑

Return Return

(bool|int) Returns false on failure. On successful update of existing metadata, returns true. On successful creation of new metadata, returns the integer ID of the new metadata row.


Top ↑

Source Source

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

function bp_xprofile_update_meta( $object_id, $object_type, $meta_key, $meta_value, $prev_value = '' ) {
	add_filter( 'query', 'bp_filter_metaid_column_name' );
	add_filter( 'query', 'bp_xprofile_filter_meta_query' );
	$retval = update_metadata( 'xprofile_' . $object_type, $object_id, $meta_key, $meta_value, $prev_value );
	remove_filter( 'query', 'bp_xprofile_filter_meta_query' );
	remove_filter( 'query', 'bp_filter_metaid_column_name' );

	return $retval;
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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