bp_update_user_meta( int $user_id, string $key, mixed $value, mixed $prev_value = '' )

Update a piece of usermeta.

Description

This is a wrapper for update_user_meta() that allows for easy use of bp_get_user_meta_key(), thereby increasing compatibility with non-standard BP setups.

See also

Parameters

$user_id

(int) (Required) The ID of the user whose meta you're setting.

$key

(string) (Required) The meta key to set.

$value

(mixed) (Required) Metadata value.

$prev_value

(mixed) (Optional) Previous value to check before removing.

Default value: ''

Return

(bool) False on failure, true on success.

Source

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

function bp_update_user_meta( $user_id, $key, $value, $prev_value = '' ) {
	return update_user_meta( $user_id, bp_get_user_meta_key( $key ), $value, $prev_value );
}

Changelog

Changelog
Version Description
BuddyPress 1.5.0 Introduced.

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.