bp_messages_update_meta

Update a piece of message metadata.

Description

bp_messages_update_meta( (int) $message_id, (string|bool) $meta_key, (string|bool) $meta_value, (string) $prev_value = '' ); 

Parameters (4)

0. $message_id (int)
ID of the message to have meta deleted for.
1. $meta_key (string|bool)
Meta key to update.
2. $meta_value (string|bool)
Meta value to update.
3. $prev_value — Optional. (string) => ''
If specified, only update existing metadata entries with the specified value. Otherwise, update all entries.

Usage

  1. if ( !function_exists( 'bp_messages_update_meta' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-messages/bp-messages-functions.php'; 
  3.  
  4. // ID of the message to have meta deleted for. 
  5. $message_id = -1; 
  6.  
  7. // Meta key to update. 
  8. $meta_key = null; 
  9.  
  10. // Meta value to update. 
  11. $meta_value = null; 
  12.  
  13. // If specified, only update existing metadata entries with 
  14. // the specified value. Otherwise, update all entries. 
  15. $prev_value = ''; 
  16.  
  17. // NOTICE! Understand what this does before running. 
  18. $result = bp_messages_update_meta($message_id, $meta_key, $meta_value, $prev_value); 
  19.  

Defined (1)

The function is defined in the following location(s).

/bp-messages/bp-messages-functions.php  
  1. function bp_messages_update_meta( $message_id, $meta_key, $meta_value, $prev_value = '' ) { 
  2. $retval = update_metadata( 'message', $message_id, $meta_key, $meta_value, $prev_value ); 
  3.  
  4. return $retval;